[Mono-dev] question regarding Mono PInvoke shared library loading behavior

Koushik K. Dutta koush at koushikdutta.com
Thu Jan 29 05:36:07 EST 2009

Hi, I had a question regarding how P/Invoke and shared library loading works on Mono.

I am trying to run Dalvik (Android's VM) and Mono side by side in the same process. To achieve this, I added some JNI hooks to libmono, and start mono_main from within Dalvik in that fashion. This part is working great.

I then have my Mono application also PInvoke into libmono. My assumption was that Mono would use the already loaded libmono, but instead, it seems to be loading a second copy. This is causing issues with my approach, because assumed I could use a couple global variables to set a couple callback pointers, but since two libraries are being loaded, this won't work.

Is the loading of a second copy of that shared library expected? (ie, the mono runtime and the managed application intentionally can't load the same native dependencies)

Does anyone have any suggestions as to a better way to do this? Perhaps internal calls to proxy calls back into Dalvik?

Koushik Dutta

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090129/07bc276a/attachment.html 

More information about the Mono-devel-list mailing list