15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


DLL loading problem

Dmitry Davidovich -- dmitry@enigma.co.il
Thursday, August 08, 1996

Environment: Win 95, VC 4.1

Problem: LoadLibrary failed with extended error
1114 (ERROR_DLL_INIT_FAILED).
All external links resolved and additional DLL's loaded,
but Win not call _DllMainCRTStartup (entry point).

_DllMainCRTStartup is really entry point (shown by QuickView)

DLL compiled with MFC and CRT staticaly linked and multithreaded.
The same DLL without some code loads OK.

Any suggestions ?


+++++++++++++++++++++++++++++++++++++++++
Dmitry Davidovich
CS Tel Aviv University
dmitry@enigma.co.il
ddmitry@libra.math.tau.ac.il
+++++++++++++++++++++++++++++++++++++++++



Mike Blaszczak -- mikeblas@nwlink.com
Sunday, August 11, 1996

At 10:18 PM 8/8/96 +2, you wrote:

>Problem: LoadLibrary failed with extended error
>1114 (ERROR_DLL_INIT_FAILED).
>All external links resolved and additional DLL's loaded,
>but Win not call _DllMainCRTStartup (entry point).

I can't understand what that last line means:
"Win not call _DllMainCRTStartup".

>_DllMainCRTStartup is really entry point (shown by QuickView)

That's the way it should be for DLLs that use the CRTL.

>DLL compiled with MFC and CRT staticaly linked and multithreaded.
>The same DLL without some code loads OK.

The error message means extactly what it says: Windows tried to load and
locate a DLL on your behalf. If found the DLL file, and got it into memory, but
couldn't get it initialized properly.  I think you should put a breakpoint
on _DllMainCRTStartup and trace through it to figure out why it's returning
FALSE and causing Windows to not load it.

If your last line above means that Windows isn't calling your 
_DllMainCRTStartup, the problem most likely involves some other DLL that
your loading DLL is dependent upon.  It's possible that Windows goes
after your DLL, finds your DLL is dependent on another DLL, and then tries
to load that DLL.  That other DLL will be initialized first--if its
initialization code fails, your DLL's entry point won't even be called
because Windows knows you can't possibly run without the DLL you need.

I think that the checked build of Windows 95 and Windows NT will print out
the exact DLL that failed initialization, but I can't remember for sure.



.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |