[Mono-osx] DLLImport Cocoa dylib with C interface

Fred Priese fpriese at mobilearmor.com
Thu Dec 4 17:24:44 EST 2008

I have a Cocoa Dynamic Library that exposes a simplified C interface for
DLLImport purposes.  The C interface is implemented within a class with no
Obj-C code in it.  It exists simply to hold the C functions.

I am modeling this after a C++/extern "C" setup we used on another dylib.

My Mono project is successfully finding the dylib but I am getting a

>From the Cocoa code:
void getFoo(int size, unsigned char* strData);

nm on the dylib returns:
00005282 t _getFoo
(Among other names and what not.)

I am doing the DLLImport like this:
[DllImport("DylibName", CharSet = CharSet.Unicode, ExactSpelling=false,
private static extern void _getFoo(int size, byte[] strData);

DylibName is mapped to the actual dylib's name in a DLL Mapping .config
It all compiles.

I have tried it without some of the DllImport attributes and with others.

The examples above are coped from Terminal and my code respectively.  I
merely changed the method name.

Does anyone have any direction on how to proceed?  Am I missing any needed

Thanks in advance!
View this message in context: http://www.nabble.com/DLLImport-Cocoa-dylib-with-C-interface-tp20843846p20843846.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list