I'm trying to write an ActiveX plugin, and I'm finding myself in a dead end when trying to load DLLs from subfolders. I am developing in Visual Studio 2013 for Windows 10.
The structure of the libraries is as follows:
myocx.ocx --> this is the compiled result
mylibs/
mainlib.lib
maindll.dll
rest-of-dlls.dll
I do not load the DLLs directly in my code, instead they are used by the "mainlib.lib" library. I have tried to set in "Additional dependencies" of the VS Linker the path to the mainlib.lib file, and it fails to register my plugin. If I specify "maindll.dll" as a delayed load DLL, then it compiles, but the plugin does not work (it fails at some point in delayhlp.cpp).
I have read the following posts:
- Altering DLL search path for static linked DLL
- C++ set dll search location
- Load DLL from other folder than the current
- C++ Load DLL From a Subdirectory?
And the following docs from Microsoft:
I tried to add the path to the libraries to my system's PATH environment variable, but for some reason it does not work on some PCs.
I also have tried the manifest way (as described in the first linked question), but looks like VS is completely ignoring it since I can write whatever there and it will fail no matter what.
If I put the DLLs in the same folder as the plugin, it will work, but I really need to put them in a subfolder because of compatibility issues, so that option is discarded.
I do not mind using dynamic loading, but I do not know if this is possible since the DLLs are not loaded inside my code, but in a .lib file instead. I do not mind modifying PATH variable either, but as I said, in some Windows installations it is failing.
Anyone can shed some light on this, in addition to what the linked posts say?