[MonoTouch] Help by binding objective-c

Chris Branson chris.branson at insphire.com
Wed Oct 12 03:51:44 EDT 2011


If you're calling into a lib without protocols you need to use DLLImport 
instead.

e.g.

// objC def
// NSString *RL_GetRedLaserSDKVersion();

// MonoTouch def
[DllImport ("__Internal")]
static extern IntPtr RL_GetRedLaserSDKVersion ();

DLLImports should be placed inside your project and/or DLL (but not 
within a DLL created by btouch). You will generally need to create 
friendly c# wrapper methods to handle parameters and return values, e.g.

public static string GetRedLaserSDKVersion ()
{
       NSString sdkVer = new NSString (RL_GetRedLaserSDKVersion ());
       return sdkVer.ToString ();
}

Hope that helps get you on the right track.

Chris

On 11/10/2011 13:52, catullum wrote:
> quit god, but if you see the .h of the lib there is no interface.
>   there are a lot of defineS there. is no protocol
> concretly my english is nt good enough to undersand clearly all tha you are
> writing.
> I UNDERSTAND CLEARLY YOUR example
> but it dose not help me to implement what i need.
> I'm on a death point
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Help-by-binding-objective-c-tp3892195p3894187.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch


More information about the MonoTouch mailing list