Re: Basic runtime function usage - objc_getClass
Re: Basic runtime function usage - objc_getClass
- Subject: Re: Basic runtime function usage - objc_getClass
- From: Sherm Pendley <email@hidden>
- Date: Wed, 23 Nov 2005 16:11:00 -0500
On Nov 23, 2005, at 3:37 PM, Francis Derive wrote:
Oh ma ! Horrible ! it doesn't compile !
Class myPointerToClass = (Class) objc_getClass("MYobject");
if (myPointerToClass) {
NSLog( @"%s", myPointerToClass->name);//KVC.m:32: error:
dereferencing pointer to incomplete type
} else {
NSLog(@"laClasse is NOT registered");
}
Will it be ?
You need to import an additional header:
#import <objc/objc-class.h>
Class is defined as "typedef struct objc_class* Class" in objc/
objc.h, which is (eventually) included from Cocoa.h. But, the members
in struct objc_class are actually defined in objc/objc-class.h -
which is *not* included by default. :-(
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden