I'm in the middle of moving my solution from c# to c++. I've created several native c++ dll and they just fine. It's easy to connect native dll to both c++ and c#. For c# i'm using P/Invoke for methods execution and delegate
for callback, i just pass pointer to unmanaged memory and read it using Marshall class.
Now I have opposite situation - I need to create C#
project that NOW will be used from another C#
project but LATER i will rewrite main project to C++ and so I need to access C#
project from C++. It should offer just several methods: PlaceOrder(void* pointerToStruct)
CancelOrder(void* pointerToStruct)
and one call-back delegate OrderUpdated(void* pointerToStruct)
I'm looking for hints and examples. How can I create C# project which will be usable from both native C++ and C# and offer several methods + one callback.
In particular I don't now what should I do with memory - should I write to unmanaged memory at c# and read from it at c++ or should I write to managed memory at c# and read managed memory in c++ somehow... Pointer to structures which I pass at parameters should point to unmanaged memory or managed memory etc.