[Mono-osx] MacOS bindings and MonoDevelop.

Евгений Гришуль eugeny.grishul at gmail.com
Tue May 12 18:16:51 EDT 2009


>Do you mean:
>
>    struct MyBase {
>    }
>
>    struct Derived {
>        MyBase xxx;
>        foo bar;
>    }
///===================
No, I mean:
struct NSObject { // for base classes in Objc hierarchy we holds pointer to
Objective-C object in C# proxy
    public IntPtr _handle;

    public void SomeMethodAvailableForDerivedStructs() { somePInvoke(
_handle ); }
}
struct SomeBaseObjcProxy : NSObject { // that not available in C#, but such
inheritance work well on CLR (MS VES implementation)
    public void AnotherMethodAvailableForDerivedStructs() { somePInvoke(
_handle ); } // note that "_handle" is field of NSObject
}
///===================
In raw Objective-C you can't work with OBJECTS directly but can work with
them via POINTERS to OBJECTS. My approach - is represent such pointers via
structs with size of such pointer. Creating classes ( mobjc,monobjc,cocoa# )
for such case leads to unnecessary GC overheads, structs there perform
better.
///===================
>I took a more serious look at NObjective, and I have to say that
>even if it is fast, it does not support the C# override model to
>override settings in a base class.  So it is not really suitable as a
general purpose framework.
All Objective-C methods are virtual by default in Objective-C runtime, so if
method is redefined in derived Objective-C class there is no need to
'override' it in generated proxy.

WBR,
Eugeny Grishul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20090513/31fdc19a/attachment.html 


More information about the Mono-osx mailing list