I’ve searched for any hints how I can do this, but all I found was how to redirect a SxS DLL to the local application folder.
Here is what I want to accomplish:
The (C++) Application.exe is linked to a DLL, Plugin.DLL (dependant project). This DLL is not placed inside the application directory, but in a subfolder called “plugins”. As the DLL is statically linked, the application would try to load it from the application folder.
Is there any way how I can change the search path for this particular DLL? Either through manifests or VS2008 linker configurations?
My first thought is, if you are statically linking a dll, it isnt a plugin. Just put the dll in the EXE folder and be done with it. That is the deployment configuration supported by windows for statically loaded DLLs.
That said, there are ways to achieve what you want. But they are mostly stupid, or complicated for no good reason: Your options are:
To turn a folder, with one or more dll’s into an “assembly”, simply add a file to the folder with the folders name.manifest.
So, plugins.manifest :-
It is a VERY good idea to ensure that the folder and the dll’s name is different as if the dll name is the assembly name windows starts looking at its embedded manifest file for information about the assembly.
Assuming you are using Visual Studio 7 or later, the following directive added to a .c/.cpp or .h file in the project will then make your application attempt to load dlls from the assembly rather than just the local directory: