[Mono-list] Create a shared library

Jonathan Pryor jonpryor at vt.edu
Thu Oct 28 15:03:10 EDT 2010


On Thu, 2010-10-28 at 12:07 -0400, Matt Calder wrote:
> Is it possible to compile a C# library, using mono, into a native
> shared library on a linux system? I would like to then
> call that shared library from other languages (python and R).

Short answer: No.

Workaround answer: you can create a normal C shared library which uses
Mono's embedding interface, and use this native shared library as "glue"
between your "host" environment (R, Python) to managed code, using the
embedding APIs to load assemblies, create instances of types, and invoke
methods.

See also:

        http://www.mono-project.com/Embedding_Mono
        http://www.mono-project.com/Scripting_With_Mono
        http://www.go-mono.com/docs/index.aspx?tlink=root:/embed

Once upon a time there was a `cilc` program that would attempt to
automate some of this for you, generating a GObject-like wrapper for a
set of managed types.  Unfortunately, it was long unmaintained and was
removed from Mono 2.8, but the sources may be of some use to you:

        http://github.com/mono/mono/tree/mono-2-6/mcs/tools/cilc/

 - Jon




More information about the Mono-list mailing list