I have a finished product that supports custom plugins that need to be written in Unmanaged C. It does not support managed Dll, and my preferred language is C #.
The information that must be returned to the original product is very simple and can be stored in a line.
So, I thought I could do the following:
- Write the bulk of my code in C # Dll.
- Write a wrapper in managed C ++ code that calls my C # methods.
- Write a basic Dll in unmanaged C that invokes a managed C ++ Dll.
Now the connection between managed C ++ and C # Dll is simple.
But I can't figure out how to call a C ++ managed function from an unmanaged c dll. Any help with some simple code example would be great.
thanks
EDIT: I created a Code Project article on how I did this with Alex's answer below.
http://www.codeproject.com/Tips/695387/Calling-Csharp-NET-methods-from-unmanaged-code
source
share