tags:

views:

159

answers:

3

I'm writing a DLL for an audio-player (foobar2000) using its SDK. My DLL links to another DLL, and I've done so using an import library (.lib). However, at run-time, the audio player complains that my DLL (the one that links to the other) is missing a dependency.

I don't know if this can be generalized or not, but if the first DLL is linked at runtime without an import library, then can it not link to another DLL with an import library? And if this is indeed the case, why is this so?

+1  A: 

You can link a DLL to any other DLL at runtime. The rules for linking the DLL are the same. Can you post the name of the missing dependency ? Is the dependency is the correct directory ?

Andrew Keith
A: 

Your dll should work fine, I think you have to check it with dependency walker to see what you are missing

Ahmed Said
Thanks for suggesting dependency walker. It turns out my other DLL was being compiled with /MD, which caused it to look for msvcr90.dll, which couldn't be found for whatever reason. Re-compiling the other DLL with /MT (which statically links) solved it.
psas
A: 

When OS loads a DLL (and EXE, too, of course), it looks for its import table and tries to load imported libraries too.

If they aren't found, you see error you've described.

You may use dynamic loading of dependent library using LoadLibrary and GetProcAddress to prevent it but then you'll need to handle errors with missing dependencies.

elder_george
Actually I would use Dependency Walker on the DLL to try to find out what imports the OS cannot satisfy
EFraim