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

Jonathan Pryor jonpryor@vt.edu
15 Jun 2003 22:46:06 -0400


There is a project to automate the creation of C wrapper code for
existing C++ code: swig, the Simplified Wrapper and Interface Generator.

See http://www.swig.org

It can be used to generate the C wrapper for a C++ class, and then
generate the C# wrapper code which invokes the C code.

The one downside is that C# code support is only available in the
development version, last time I checked.

 - Jon

On Sun, 2003-06-15 at 21:23, Marcus wrote:
> 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?
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list