[MonoTouch] objc_msgSend does not work correctly

Duane Wandless duane at wandless.net
Thu Oct 29 14:56:30 EDT 2009


Ha.  Yes I do.  But that library does not solve or address the potential
issue with objc_msgSend.  Which hopefully someone will let me know if I'm
going crazy... wait too late for that.

On Thu, Oct 29, 2009 at 1:32 PM, Michael Bluestein <mike.bluestein at gmail.com
> wrote:

> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091029/27aec42c/attachment.html 


More information about the MonoTouch mailing list