[Mono-dev] How to create a dynamic library for Linux?
Robert Jordan
robertj at gmx.net
Sat Dec 1 11:55:39 EST 2007
Laurent Le Brun wrote:
> Hi,
>
> I'd like to create a dynamic library (for Linux), from a .NET source
> file. I've searched in the web for this, but didn't find anything. I
> hope this is the right list for this question.
There is a reason for the lack of informations about
using a .NET assembly as a SO: there is no way to do it.
> So, I'd like to get a .so library, that I can call from C/C++ code.
> I compiled my .NET files into a .dll file. Then, I compiled it to
> native code (using mono --aot). But, the generated .so file doesn't
> export my library functions (I checked using nm). I've seen symbols
> like "method_info" or "class_info". Could they be useful for my need?
No.
>
> Is it possible to do this? Any advice or link is welcome.
> Please note the main application is written in C++, but I don't want
> to run it with mono.
You have 3 choices:
1. Embed the mono runtime. See
http://www.mono-project.com/Embedding_Mono
2. mkbundle/mkbundle2 with the --nomain option and manual
compilation & linking. See "man mkbundle".
3. Convert your C++ application to a SO and DllImport it
from a managed (C#) main application stub. In the
stub you can expose the methods using delegates that
you pass to the SO via DllImports.
Robert
More information about the Mono-devel-list
mailing list