[Mono-dev] C++ to C# to C++ interop, how can I do this in a mono-compliant way?
kring at agi.com
Thu Sep 1 10:39:06 EDT 2005
I have a similar situation, except that I'm planning to address it on
Windows using COM interop rather than mixed-mode C++. I posted to this
list last week asking for advice on how to best do something similar
Jonathan Pryor pointed me to the Mono embedding API
(http://www.mono-project.com/Embedding_Mono), which can probably be used
to do exactly what you want. The page describes a way to call managed
methods from C and also to call back into C from the managed world. It
is quite a bit clunkier than either mixed-mode C++ or COM interop,
though. He also pointed me to a Mono utility called cilc which can be
used to generate C wrappers for the classes and methods in an assembly,
which helps with some of the clunkyness. Eventually I'd like to extend
cilc to generate full C++ wrappers, complete with marshalling between
CLR and C++ types, to create something a lot like COM interop for Mono.
Even better, I'd like to arrange for my company to pay an interested
person to create something like this, as it is pretty far outside of our
core area of expertise.
Some other folks had some interesting suggestions as well. Check the
August archives of this list for a thread called "COM Interop, or
something like it".
Hope this helps!
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of J
Sent: Monday, August 29, 2005 7:02 PM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] C++ to C# to C++ interop,how can I do this in a
I am looking for a way of having a C++ exe integrate with a .NET dll. I
have a solution working under Windows (Microsoft.NET 1.1) however I
would like to make this function under Mono.
Here are the details:
I currently am writing a C# wrapper of a C++ game engine. (T2D by
garagegames) I wrote this on Windows (CLR v1.1) and the main way this
works is by adding Managed code to the C++ engine (so now it is mixed
Managed/Unmanaged C++) so it can directly call into my C# DLL, and using
PInvoke to have the C# DLL talk balk to the C++ engine.
The C++ engine itself is OS agnostic (it works on windows, linux and
mac), and I would love to make this C# wrapper work under mono, so that
it is OS agnostic as well.
However, http://www.go-mono.com/faq.html#63 informs me that Mixed mode
assemblies do not work under mono.
Is there any way to have this work under Mono? Please realize that the
basic need is to have 1 instance of a C++ exe call into a .NET dll, and
have that DLL be able to then execute functions in the C++ exe that
called it. So this requires a mono-equivlant of PInvoke, plus a way
to have the C++ app call the C# app.
Help on this would be appreciated, otherwise it'll be Windows only!
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list