[Mono-dev] Embedding Mono: multiple calls to mono_jit_init

Ivo Smits Ivo at UFO-Net.nl
Fri May 13 10:01:52 EDT 2011


Wikipedia described how this can be done:
http://en.wikipedia.org/wiki/Dynamic_loading#In_C.2FC.2B.2B

It's not so difficult at all. You just need to create function pointer 
variables for the functions you want to call, then use dlopen(...) to 
open the mono library, and dlsym(...) to lookup a symbol.

However, do you really need to cleanup/unload the mono runtime? You 
could use a global variable to indicate whether the mono runtime has 
been initialized before, and if it is you don't initialize the runtime 
again. You don't need to unload the runtime itself. If you want to get 
rid of what's running, you can probably unload the assembly and 
application domain.

--
Ivo

Op 13-5-2011 15:30, Zoltan Varga schreef:
> You need to use mono's shared library libmono.so, and somehow make the 
> OS load/unload it. Its not easy to do, but doable.
>
>                            Zoltan
>
> On Fri, May 13, 2011 at 2:43 PM, MartinAlexander 
> <martin.arvidsson at gmail.com <mailto:martin.arvidsson at gmail.com>> wrote:
>
>     How do you mean? I think this is what I am doing now . I admit I
>     was unclear
>     but the commercial application is written in native C++ and calls
>     my native
>     library (dll/so). In OnInit I call mono_jit_init and in OnUninit I
>     call
>     mono_jit_cleanup.
>
>     --
>     View this message in context:
>     http://mono.1490590.n4.nabble.com/Embedding-Mono-multiple-calls-to-mono-jit-init-tp3519842p3520110.html
>     Sent from the Mono - Dev mailing list archive at Nabble.com.
>     _______________________________________________
>     Mono-devel-list mailing list
>     Mono-devel-list at lists.ximian.com
>     <mailto:Mono-devel-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110513/dec16bf6/attachment-0001.html 


More information about the Mono-devel-list mailing list