objective c - How do you bind to or invoke Foundation functions? -
i'm interested in binding ios foundation functions seen in ios documentation there aren't handles or instances send message invoke them. how monotouch? think involve within monotouch.objcruntime namespace.
all of monotouch's ns* objects implement monotouch.objcruntime.inativeobject interface has property getter called "handle". accessor public on nsobject , subclasses.
edit: code bind nssetuncaughtexceptionhandler()
this:
public delegate void nsuncaughtexceptionhandler (intptr exception); [dllimport ("/system/library/frameworks/foundation.framework/foundation")] extern static void nssetuncaughtexceptionhandler (intptr handler);
then use this:
static void myuncaughtexceptionhandler (intptr exception) { // got exception... } static void main (string[] args) { nssetmyuncaughtexceptionhandler (marshal.getfunctionpointerfordelegate( new nsuncaughtexceptionhandler( myuncaughtexceptionhandler ) ); }
Comments
Post a Comment