[Mono-list] P/Invoke to dlopen

Robert Jordan robertj at gmx.net
Wed Aug 5 06:08:37 EDT 2009


Dallman, John wrote:
> Dino Viehland wrote: 
> 
>> So for dlopen I need to know what the P/Invoke signature should look like.  
>> Ideally that signature would work on all *nix systems.
> 
> Robert has given you the runes for Linux, but dlopen and dlsym come from 
> different places on other *nix systems:
> 
> Mac OS X: libSystem.B.Dylib
> Solaris:  ld.so

This can be configured from outside with mono dllmaps.
See mono-config(5).

<configuration>
   <dllmap dll="libdl.so" target="some other dylib" os="osx"/>
   <dllmap dll="libdl.so" target="some other so" os="solaris"/>
</configuration>

> And so on on other systems. Dlopen also tends to have quite complicated 
> behaviour on all of them, with 32-vs-64 issues, various control flags, 
> etc. We try hard to avoid using it; I appreciate you don't have a choice, 
> but getting it all straight is unlikely to be quick or easy. 

Well, look at Mono's util/mono-dl.[c|h]. It is supporting only
dlopen and Win32-like APIs w/out any platform specific handling
other than SO extension handling. So p/invoking dlopen is sufficient.

Robert



More information about the Mono-list mailing list