[Mono-devel-list] accessing c++ library from a mono application
Jonathan Pryor
jonpryor at vt.edu
Sat May 3 09:30:08 EDT 2003
Yes. There are three ways to do it:
1- The easy, proprietary way: Use Managed Extensions to C++ to wrap the
C++ library, exposing it to the CLI runtime. The problem with this is
that Managed Extensions to C++ work only under Visual C++ (though this
may change), and the resulting binaries work only under .NET.
2- The portable, hard way: Write a C wrapper for the C++ library,
providing functions to create, destroy, and invoke methods of all the
C++ classes. Then write a C++ wrapper of the C wrapper, which
DllImports the C functions and invokes them.
This is what Qt# does, AFAIK.
3- The portable, easy way: Use a wrapper generator such as SWIG
(http://www.swig.org), which will do all the wrapping for you. This may
have some problems, however, including: (a) the C# support in SWIG is
still under development, and is only available in a development release
(1.3.19); (b) SWIG may not be able to understand all C++ programs and
wrap them properly; and (c) not everything is handled transparently. An
interface definition (the functions prototypes of exported functions)
*may* need to be written, and templates will likely require special
attention. See: http://www.swig.org/tutorial.html.
An example of this was posted to mono-list last December; see:
http://lists.ximian.com/archives/public/mono-list/2002-December/010101.html
- Jon
On Fri, 2003-05-02 at 09:42, Sven Herzberg wrote:
> Hi,
>
> is it possible to use a c++ library from a mono application?
>
> Sven
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list