[Mono-list] P/Invoke to dlopen

Dino Viehland dinov at microsoft.com
Tue Aug 4 19:30:50 EDT 2009


For IronPython's new ctypes module (basically P/Invoke for Python) I need to be able to P/Invoke out to dlopen and dlsym.

Ideally I was hoping that Mono's P/Invoke mapping mechanism was going to cover and convert LoadLibrary/GetProcAddress
to the appropriate functions.  But dlopen in particular has a different signature and IronPython users might want to
call it and pass the mode option.

So for dlopen I need to know what the P/Invoke signature should look like.  Ideally that signature would work on all *nix systems.
The tricky thing seems to be that while it's part of POSIX that only covers how it's exposed to C via header files.  Does Mono
expose this somehow or will a P/Invoke to something like "libc" be properly routed?  I see from the docs I can P/Invoke
to __Internal as the "DLL" name but I'm not sure if (or why) this would include dlopen.

For dlsym I would hope that Mono's normal P/Invoke mapping mechanism could handle it because the signature matches
the Win32 sig for GetProcAddress.  Is that an unrealistic expectation?

Any thoughts or recommendations on a better way to go?

[if this shows up twice sorry - my first attempt is in moderation]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090804/30f9faa0/attachment.html 


More information about the Mono-list mailing list