[mono-android] C to C#

Goncalo Oliveira goncalo at minkan.net
Mon Feb 20 17:15:09 UTC 2012


Hi,


This is not exactly Android specific, but I am writing a wrapper for a
native library using the C header as a reference.
I'm not sure if I'm doing this wrong, or there's something else beyond the
wrapper, so maybe someone can help me out, I'm a bit rusty on these things.

C header

// callback (ConnEventType is an enum)
typedef void (*CommCallback) (ConnEventType status, unsigned long connID);

// method (callingConvention is also an enum)
long Msg_StartUp (void *pConnEventFn, const char *pConfigPath, bool
bIsProLicensed = true, bool bIsSDKLicensed = true, bool bStartConnection =
true, callingConvention convention = convention_default);

C#

// callback
delegate void DelegateCommCallback( ConnEventType status, uint connID );

// metohd
[DllImport( "libsdk", EntryPoint = "Java_com_sdk_Msg_Msg_1StartUp", CharSet
= CharSet.Auto )]
private static extern int Msg_StartUp( DelegateCommCallback commCallback,
byte[] configDir, bool isProLicensed, bool isSDKLicensed, bool
startConnection, int convention );


Does this seem wrong to anyone?
Cheers


-- 
Gonçalo Oliveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120220/9d197443/attachment.html>


More information about the Monodroid mailing list