[Mono-devel-list] Calling unmanaged code from C#

Matt Davey Matt.Davey at finetix.com
Fri Feb 6 18:54:16 EST 2004

Thanks for the reply, I appreciate the help

----- Original Message ----- 
From: "Marcus" <mathpup at mylinuxisp.com>
To: <mono-devel-list at lists.ximian.com>
Cc: "Matt Davey" <Matt.Davey at finetix.com>
Sent: Friday, February 06, 2004 10:38 PM
Subject: Re: [Mono-devel-list] Calling unmanaged code from C#

> I believe so. Unfortunately, GCC does not have the equivalent of Visual
> ability to mix unmanaged and managed code. I see that TIBCO's RV libraries
> are available with both C and C++ APIs. You will probably want to use the
> API with DllImport. Calling C++ from C# directly with GCC as the C++
> is difficult-and-non-portable or impossible, without an intermediate C
> support library.
> Brief list of problems:
> First, there is no way to create a new instance of a C++ object from
> C++ unless the C++ library provides an appropriate function. There is no
> obvious way to determine how much memory to allocate for a given C++
> so even if it were possible to call a C++ constructor directly to
> the object, allocating the memory for the object in the first place seems
> impossible.
> Second, C++ compilers use name-mangling to avoid duplication of symbols
> several classes define the same method and when overloaded methods are
> This mangling is platform dependent. It is possible to use system-specific
> utilities to produce a list of mangled and unmanagled names and then match
> them up to create a conversion table. So this is more of an annoyance than
> an outright dead-end.
> Third, when optimization is specified, C++ compilers frequently inline any
> methods those bodies are defined within the class scope (and possibly
> methods as well). Moreover, if every invocation of a method is inlined,
> compilers do not by default emit an out-of-line copy for the method. This
> the default for GCC when optimization is selected.
> On Friday 06 February 2004 2:56 pm, Matt Davey wrote:
> > Hi,
> >
> > I have an app that runs on MIcrosoft .NET that is build with C# calling
> > Visual C++ Managed wrapper around the TIBCO RV libraries
> > (http://www.tibco.com/software/enterprise_backbone/rendezvous.jsp).
> >
> > I want to move the app to Mono on RedHat. Am I correct is thinking that
> > instead of using the managed/unmanaged Visual C++ component on Mono, I
> > should build a C# component that wrappers the tibco .so file, and
> > methd via DllImport ?

More information about the Mono-devel-list mailing list