[Mono-list] P/Invoke to dlopen
Robert Jordan
robertj at gmx.net
Wed Aug 5 05:11:18 EDT 2009
Dino Viehland wrote:
> 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.
Mono does not automatically map between Win32 API calls and POSIX/libc.
> Any thoughts or recommendations on a better way to go?
P/Invoke dlopen and dlsym from "libdl.so":
const int RTLD_NOW = 2; // for dlopen's flags
[DllImport("libdl.so")]
static extern IntPtr dlopen(string filename, int flags);
[DllImport("libdl.so")]
static extern IntPtr dlsym(IntPtr handle, string symbol);
Robert
More information about the Mono-list
mailing list