I am writing a plugin (P) for a Windows application (A). The plugin is reliant on some assemblies from a third party SDK, and their dependencies. The deployed application looks like this:
C:\Program Files\A\plugins\P
The main application assembles are deployed in the A directory, while both the plugin and SDK are deployed in directory P.
The main application statically loads its dependencies at startup and finds its plugins by using a probing privatePath. The third party assemblies dynamically load their dependencies using LoadLibrary. The plugin uses SetDllDirectory to add the directory containing the third party SDK to the LoadLibrary search path.
With me so far?
Until recently, the above worked as expected and everyone was happy. However, a recent upgrade to the main application (specifically an upgrade in the Open Inventor version) broke the status quo. Now, as best as I can tell, the path being set by SetDllDirectory is no longer being used and the third party assemblies cannot find their dependencies and our plugin crashes.
If we move the third party assemblies to the main application folder, this fixes the problem, however our agreement with the manufacturer of the main application prevents us from deploying this commercially.
So, my question is: what might have changed to prevent SetDllDirectory working? What else might be the problem other than the SetDllDirectory? How can we tell the third party assemblies where to find their dependencies.
The developers of the main application claim that nothing has changed in their code/configuration that should affect the search paths, and they say they do not use SettDllDirectory internally. Without access to their source control I have no way of disproving this.
Note that this is a 64bit application running on 64bit Vista.
Any thoughts? I'm stumped.
Update I have subsequently discovered that OIV also uses SetDllDirectory(). Would this explain why we can no longer set the value? Does this mean the value can only be set once per process? Preseumably this means that if we use SetDllDirectory() if could have an adverse affect on other plugins...?