[Mono-osx] P/invoke 32-bit C library

Uli Hertlein uli at xdt.com.au
Wed Sep 14 10:41:28 EDT 2011


Hi Andrew,

On 09/14/2011 04:27 PM, Andrew Ayre wrote:
> I have recompiled the library using gcc in MonoDevelop and called it
> from a C-based console application, also using gcc in MonoDevelop, on OS
> X. This works fine also. I use -m32 to make everything 32-bit so cdecl
> can continue to be used.
>
> Now I want to use it from C# on OS X. I've renamed the library from
> libfoo.so to Foo.dll, which is what it is called when compiled for
> Windows. I believe this should allow me to use my simple C# wrapper that
> I use in Windows without having to recompile it. However I get a
> System.EntryPointNotFoundException for _fm_connect.

Try dropping the leading '_' in the DllImport.

I'm doing exactly the same and don't specify the leading underscore in the DllImport statement and 
it's fine.  (I guess some layer along the way adds it automatically?)

And yes, my symbols also have it in the dylib.

Cheers,
/uli

-- 
Ulrich Hertlein
Research and Development   mailto:uli at xdt.com.au
XDT Pty Ltd                http://www.xdt.com.au


More information about the Mono-osx mailing list