[Mono-dev] question regarding Mono PInvoke shared library loadingbehavior

BGB cr88192 at hotmail.com
Thu Jan 29 06:06:55 EST 2009


well, I don't know the specifics or much of anything about Android... (I will assume here that it works under similar principles to Windows or Linux...).

but, my guess is that maybe the first library is a static library?...
if this is the case, if a shared library can be used instead, maybe this could help?...


for example, the first copy is linked statically, and so is absorbed into the app in question.
later, P/Invoke involves asking the shared-library code for the library in question, and given the library was static, it is not seen by the shared-library code, followed by it proceeding to load the shared library.


or, if you mean it is loading 2 copies of the same shared library, I would assume this is a bug (presumably with the OS, or potentially failure to correctly use whatever library loading facilities are provided).


don't know if this is any help (or even correct, in this case...).

(hmm... I have gotten self-conscious, wondering if I am "young" having been born in the 80s. or at least by compiler/VM writer standards. but then again, I am much older than anyone born in the 90s. hmm...).


  ----- Original Message ----- 
  From: Koushik K. Dutta 
  To: mono-devel-list at lists.ximian.com 
  Sent: Thursday, January 29, 2009 8:36 PM
  Subject: [Mono-dev] question regarding Mono PInvoke shared library loadingbehavior


  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

  www.koushikdutta.com

   



------------------------------------------------------------------------------


  _______________________________________________
  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/20090129/17726062/attachment.html 


More information about the Mono-devel-list mailing list