First i will explain my situation. I have a DLL library that is a black box to me. I don't know for sure in what language was it written. My guess it is C++ or even in C, but i don't know. But i DO know that DLL functions so I know how to use it.
Ok. Straight to businesses. I'm writing application C# .NET that will work with that DLL mentioned above. I tried all know to me linking methods but only one works:
- Static:
[DllImport("myDll.dll")]
- That works. - Dynamic: by Kernel32.dll LoadLibrary/FreeLibrary - I'm getting exception with code 126 -
The specified module could not be found
. That problem lays in missing dependence. - Dynamic: by Reflection - When using Assembly.LoadFile(aPathFileName), I'm getting exception:
The module was expected to contain an assembly manifest
.
My problem is, that i really need to specify path to my black box dll in some sort of configuration file. Can I ask for any tip what I can do now, how i can resolve this problem? More specific: Is there ANY way to load string from config file and use it to fill constant string, required by static linking DllImport(const string path); or there is another way to dynamic link dll that i don't know?
EDIT
Answer to possible duplicate of another question: Both answers of that question reference to methods i can't use. As i said, i can't use LoadLibrary (exception 126) and also i can't specify loot of possible paths hardcoded (i said that i need load path from config file)