[Mono-osx] external reference to a class
duane at wandless.net
Fri Nov 6 17:49:51 EST 2009
That is much better... thank you for suggesting this.
On Fri, Nov 6, 2009 at 2:53 AM, Laurent Etiemble <laurent.etiemble at gmail.com
> Why don't you use the "NSClassFromString" function
> ? The return type is a Class instance, and is not as low-level as a
> call to objc_getClass().
> [NSClassFromString(@"MyMonoClass") testTouch];
> Note 1: See http://www.cocoadev.com/index.pl?NSClassFromString for more
> Note 2: you can even define a macro to avoid the cluttering of your code.
> Regards, Laurent Etiemble.
> 2009/10/22 Duane Wandless <duane at wandless.net>:
> > Hopefully someone can help with this.
> > I am currently doing this.
> > id myobj = objc_getClass("MyMonoClass");
> > [myobj testTouch];
> > which works. MyMonoClass is not defined so I cannot do this:
> > [MyMonoClass testTouch];
> > Because the compiler tries to resolve the class reference, of course.
> > Is there a better way to do this than what I have? Which I got the idea
> > how to do this from Monobjc!
> > The context is that I have a Cocoa application that loads the mono
> > which loads my Monobjc enabled library. Which that is where MyMonoClass
> > defined. Then I need to invoke a method on the mono class from Cocoa.
> > Thanks,
> > Duane
> > _______________________________________________
> > Mono-osx mailing list
> > Mono-osx at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-osx
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-osx