[MonoTouch] objc_msgSend does not work correctly
Duane Wandless
duane at wandless.net
Thu Oct 29 12:44:31 EDT 2009
I am binding to an existing objc-c library, cocos2d. The objc-c interfaces
I'm binding to are:
@interface CocosNode {
}
-(id) onEnter;
@end
@interface Layer : CocosNode {
}
@end
@interface ColorLayer : Layer {
}
@end
So I have C# classes that match those:
[Register("CocosNode")]
public partial class CocosNode : NSObject
[Register("Layer")]
public partial class Layer : CocosNode
[Register("ColorLayer")]
public partial class ColorLayer : Layer
Then I have:
[Register("MyLayer")]
public class MyLayer : ColorLayer
MyLayer needs to respond to OnEnter when invoked from objc-c. So I have
this which works as expected.
[Export("onEnter")]
public void OnEnter()
I have added my logic to OnEnter() and now must call [super onEnter].
If I try either of these I get into an infinite loop. The objc_msgSend call
invokes my C# OnEnter() method:
MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (
this.Handle, new Selector("onEnter").Handle);
MonoTouch.ObjCRuntime.Messaging.void_objc_msgSendSuper (
this.SuperHandle, new Selector("onEnter").Handle);
Is there something I'm missing? How should I invoke [super onEnter]?
Thanks
Duane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091029/6a89bf18/attachment-0001.html
More information about the MonoTouch
mailing list