[Mono-list] .NET/C++ Interop

Marcus mathpup@mylinuxisp.com
Sun, 15 Jun 2003 20:23:16 -0500


I do not know of any Managed C++ compilers other than VS.NET. I would really 
like to see a minimal Managed C++ compiler to help with the integration of C# 
and C++.

The main problems in using C++ with C# is that object allocation must be done 
through C/C++ and that function names in C++ are "mangled". 

It is possible to call C++ from Mono. There are two approaches. One is to 
create a C "glue" library so that C# calls the C-glue and the C-glue calls 
C++. The C library must be build using the same compiler that built the C++ 
library to ensure compatible object allocation and name mangling. It is also 
possible to call from C# to C++ directly for normal method calls, but C# 
extern declarations must include the mangled names (possibly using the 
EntryPoint modified of DllImport). Object allocation still needs some C glue, 
however.


On Sunday 15 June 2003 4:37 pm, GUSTAVO GARCIA BERNARDO wrote:
> Hi,
>
> How can i use a C++ library from mono .NET framework?
> With Microsoft Framework I can create a C++ managed
> or a COM wrapper; It's this possible with mono?  Are
> there any solution with PInvoke?