|
Hello,
I am facing an issue I cannot easily solve. I am writing a non-managed C++
application that I want to be extensible using plugins. The goal is to let
people write plugins in any language they want including C# (but also C++,
Delphi or whatever...). The way I am doing things right now is to write a
managed C++ wrapper that implements the callbacks required by the
application to be recognized as a plugin and uses code written in C# and
provided as a DLL. I therefore have two DLL's for one plugin: the C++
wrapper and the C# real stuff.
This works fine except for one issue: it would be nice to place in a
"plugins" directory next to the application binary. Ideally I should
therefore have the following layout (final version also has each plugin in
its own subfolder of the plugins directory but let's keep it simple for the
moment):
-- app.exe (unmanaged C++)
-- plugins
----- wrapper.dll (managed C++)
----- plugin.dll (C#)
The problem is that wrapper.dll does not resolve the plugin.dll assembly
unless I put it next to app.exe which is not very nice. I tried to solve the
issue by using AppDomain::CurrentDomain->AppendPrivatePath("plugins"); in
wrapper.dll but this does not work neither. Please note that my AppDomain's
BaseDirectory is the folder of app.exe and not the plugins folder so it
seems like I get the AppDomain of the application and not the one of the DLL
although app.exe is not managed... I tried a lot of things but cannot reach
anything working.
Again, there is no problem mixing all these languages (C# code wrapped by
managed C++ code for a unmanaged C++ application) as if I put plugin.dll
besides app.exe everything works fine.
Thanks for any help!
Regards,
mynab |