tags:

views:

164

answers:

3

What happens when I load some dll at run-time (let's call it Lib1.dll) but Lib1.dll also depends on Lib2.dll but Lib2.dll is not there?

+3  A: 

If there is a missing dependency, the program won't run: an exception/error will be thrown when an access to the DLL is attempted.

jldupont
A: 

you will get a I/O error when it tries to use something from that dll. it will say it cant load it

AutomatedTester
The error/exception happens immediately at load time of the DLL, not when it is used.
gwell
depends how its been used. If you do lazy loading it may load and use at the same time
AutomatedTester
+2  A: 

It depends (sorry). If the DLL in question is statically linked to the missing DLL, then the LoadLibrary call will fail with error 126 (ERROR_MOD_NOT_FOUND). If, however, the DLL attempts to load the missing DLL dynamically (e.g., with LoadLibrary), then the original LoadLibrary call may succeed. The behavior may also change for delay loaded libraries.

Mark Wilkins