• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Basic runtime function usage - objc_getClass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic runtime function usage - objc_getClass


  • Subject: Re: Basic runtime function usage - objc_getClass
  • From: Francis Derive <email@hidden>
  • Date: Wed, 23 Nov 2005 22:40:43 +0100


On Nov 23, 2005, at 10:11 PM, Sherm Pendley wrote:

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--

It had to be ! But what a pain ! I feel confused for the embarrassment to the extreme edge.


Merci beaucoup,

Francis.
_______________________________________________
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


References: 
 >Basic runtime function usage - objc_getClass (From: Francis Derive <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Sherm Pendley <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Francis Derive <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Francis Derive <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Deprecated methods in NSDocument
  • Next by Date: Re: Deprecated methods in NSDocument
  • Previous by thread: Re: Basic runtime function usage - objc_getClass
  • Next by thread: Re: Basic runtime function usage - objc_getClass
  • Index(es):
    • Date
    • Thread