This is less about exact answers, and more about advice, and getting my head on straight. I have a complex scenario(for me anyways), and I've got myself twisted up, and can't see the solution.
1. I have a native .exe
2. I have a native DLL injected into the .exe
3. I have managed resources exposed in my native DLL
4. I have created a plugin system in my native DLL that loads .Net(C#) plugins, which in turn uses the exposed managed resources from the native DLL
This all works fine, I have no problems here.
What I'm trying to do, is take data from the .exe, and move it all the way to the C# world, where it can be modified by plugin makers, and sent back. (I've already done this to an extent via some wrapped classes, etc,.)
The problem comes in here:
I want to trigger a managed event from a function hook in my .exe.
I use an abstract class like this for C# consumption, and as my plugin systems main interface.
public ref class Script abstract
{
public:
virtual void Update() = 0;
};
So anyone writing a plugin would just implement that class, and the .exe will trigger the update block via another hook already in place.
So, I want my events to be subscribe-able from user(plugin) classes that implement this base class. (I also need to be able to pass data through, but, let's keep it simple, no params, etc,.)
Anyways, thinking my way from .exe to DLL to C++\CLI(managed), to external .Net plugins, and back, is frying my brain, and the solution just won't come to me. (I'm sure I could hack something together, but, I wanted the advice of some pro's, so I don't end up with some monstrosity, or worse re-invent any wheels.)
(I'm basing this project on GTA IV Script Hook.Net, so I know that all of my goals are possible, but, I'm guessing at implementations, since no source code exists for it.)