[Mono-osx] Statics and Singletons with Dumbarton

Andreas Färber andreas.faerber at web.de
Tue Jan 2 06:34:03 EST 2007

Am 02.01.2007 um 12:03 schrieb R. Tyler Ballance:

>>> 	As far as I can tell there's not really a feasible way to call  
>>> static methods through the Dumbarton bridge [...] almost all the  
>>> calls require an instatiated MonoObject before invoking a method.
>> Supply NULL as the MonoObject* instance, similarly to managed  
>> reflection (null in C#).
> How does this specifically translate to using singletons via  
> Dumbarton? in the + (SingletonObject)sharedObject method instead of  
> calling:
> instance = [[self alloc] init];
> calling something like
> instance = [[[self alloc] initWithMonoObject:NULL];
> and then using
> instance = [self getProperty:"Instance"];
> Looking over some of the embedding examples code, I've got a good  
> idea of what you mean in terms of passing NULL, but I'm having  
> trouble translating that to Dumbarton-Cocoa :P

No idea, I don't use Dumbarton in my Cocoa app. But even when using  
Dumbarton you can use the embedding functions of Mono directly like  
Dumbarton as a wrapper does internally, or if it's missing in  
Dumbarton patch it in.
The initWithMonoObject:NULL above will not lead to success as Mono  
cannot retrieve a MonoClass* from a NULL reference. Logically I would  
expect such ObjC messages at a class wrapper, say result = [myClass  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20070102/ea5bbd21/attachment.html 

More information about the Mono-osx mailing list