Strange bug with DLLNotFoundException

Started by
0 comments, last by Little Coding Fox 14 years, 9 months ago
Greetings everyone, I have a C# program that calls C functions from a Native C++ DLL, using the DLLImport attribute on some functions. However, whenever i try to call any of the functions, i get a DLLNotFoundException. I have the C# program compile to x86 only, and the DLL is in the exact same folder as the executable, yet it will constantly tell me the DLL could not be found, "The module could not be found". However, if i e.g., copy the program's executable and rename it as the DLL's filename, it'll instead tell me it can't find the entry points it needs, which means it did find and load the "DLL". I have the DLL's functions being exported with C linkage, and i'm using Visual Studio 2008 Professional. I'm also sure the Working Directory is correct. Even running the program on the same folder as the DLL will terminate with a crash (uncaught Exception). Would anybody have any idea as to what could be causing this strange behaviour? Thank you very much for your time regarding this message, and have a nice day!
Advertisement
I figured out what's wrong, it would seem that the lack of a DLL on the DLL's dependencies would cause this exception, without warning. Using dumpbin /imports helped me notice that a DLL was missing.

This topic is closed to new replies.

Advertisement