I have a client application in my own C ++ code that uses native C ++ dlls. I am exploring the possibility of connecting this code with C # dll, as it would be much easier to write them. I decided to write a C ++ / cli bridge dll that can be loaded using LoadLibrary and which will pass C # dll calls.
The connection between the client and the dll is such that the client passes a pointer to an interface object through which the DLL interacts with the client. I wrapped this object in C ++ / cli bridge code for C # code to use it.
The bridge should also expose several functions with __declspec (dllexport) and pass these calls to C # dll, so it must have a pointer to the C # interface to which it will pass them. I wanted to use a C # object with gcroot <> shell, but the problem is that I get circular dependencies between these two dlls. C # dll needs to reference the DLL bridge in order to be able to use the wrapper class, and the dll bridge must reference the C # dll to use the interface class.
I know that I can use COM instead of wrapping a C # object with gcroot, but I would prefer not to. Is there any way around this?
Ivan
source share