[MonoTouch] objc_msgSend does not work correctly

Michael Bluestein mike.bluestein at gmail.com
Thu Oct 29 13:32:03 EDT 2009


have you seen this?

http://github.com/city41/CocosNet

On Oct 29, 2009, at 12:44 PM, Duane Wandless <duane at wandless.net> wrote:

> 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
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch


More information about the MonoTouch mailing list