V
Vincent Finn
Hi,
I have what I thought was a simple question but I can't find an answer.
I need to access (create) unmanaged C++ classes in C#.
They aren't COM and they aren't struct just simple classes.
What I currently have is the following
File view:
Form1.exe -> Controller_net.dll -> Controller.lib
Class creation:
"Form1 (C#)" creates "Controller_net (Managed C++)" creates "Controller (unmanaged
C++)"
The unmanaged code has a set of classes derived from a Command class, these
contain strings, vectors, etc.
Controller has a single public function, Execute, that takes a Command* as
an argument and then executes the command using members as inputs and setting
member variables as outputs.
The Managed dll has a matching set of classes derived from a .Net class called
Command_net, these classes create their unmanged equivalents and handle conversion
from C++ to .Net types and vice versa.
This is a very simple structure allowing the Managed C++ to handle conversion
since it understands C++ and .Net types.
I am now porting this to Linux so I wish to use Mono for the .Net side of
things, Mono doesn't support managed C++.
So I now need to take the Controller_net.dll out of the equation.
I can create the Command_net classes in C#, and I can convert Controller.lib
to a dll and use dllexport to export the unmanaged classes.
I can't see how to hook them together.
PInvoke seems to simply call functions on the dll and I need to create objects.
The only interop object creation I can see is for COM objects.
Can anyone point me in the right direction?
Thanks, Vi
I have what I thought was a simple question but I can't find an answer.
I need to access (create) unmanaged C++ classes in C#.
They aren't COM and they aren't struct just simple classes.
What I currently have is the following
File view:
Form1.exe -> Controller_net.dll -> Controller.lib
Class creation:
"Form1 (C#)" creates "Controller_net (Managed C++)" creates "Controller (unmanaged
C++)"
The unmanaged code has a set of classes derived from a Command class, these
contain strings, vectors, etc.
Controller has a single public function, Execute, that takes a Command* as
an argument and then executes the command using members as inputs and setting
member variables as outputs.
The Managed dll has a matching set of classes derived from a .Net class called
Command_net, these classes create their unmanged equivalents and handle conversion
from C++ to .Net types and vice versa.
This is a very simple structure allowing the Managed C++ to handle conversion
since it understands C++ and .Net types.
I am now porting this to Linux so I wish to use Mono for the .Net side of
things, Mono doesn't support managed C++.
So I now need to take the Controller_net.dll out of the equation.
I can create the Command_net classes in C#, and I can convert Controller.lib
to a dll and use dllexport to export the unmanaged classes.
I can't see how to hook them together.
PInvoke seems to simply call functions on the dll and I need to create objects.
The only interop object creation I can see is for COM objects.
Can anyone point me in the right direction?
Thanks, Vi