Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:38:44+00:00 2026-06-06T17:38:44+00:00

From objc.h: typedef struct objc_class *Class; but in runtime.h: struct objc_class { Class isa;

  • 0

From “objc.h”:

typedef struct objc_class *Class;

but in “runtime.h”:

struct objc_class {
    Class isa;

#if !__OBJC2__
    Class super_class                                        OBJC2_UNAVAILABLE;
    const char *name                                         OBJC2_UNAVAILABLE;
    long version                                             OBJC2_UNAVAILABLE;
    long info                                                OBJC2_UNAVAILABLE;
    long instance_size                                       OBJC2_UNAVAILABLE;
    struct objc_ivar_list *ivars                             OBJC2_UNAVAILABLE;
    struct objc_method_list **methodLists                    OBJC2_UNAVAILABLE;
    struct objc_cache *cache                                 OBJC2_UNAVAILABLE;
    struct objc_protocol_list *protocols                     OBJC2_UNAVAILABLE;
#endif

} OBJC2_UNAVAILABLE;
/* Use `Class` instead of `struct objc_class *` */

What exactly is Class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:38:46+00:00Added an answer on June 6, 2026 at 5:38 pm
    typedef struct objc_class *Class;
    

    ^ That is a forward declaration for an objc_class pointer. It gives it the nice friendly name Class.

    Now lets take a look at the objc_class struct:
    (Removing Objective-C 2.0 checks to shorten it up)

    struct objc_class {
        Class isa;
    };
    //This is really saying
    struct objc_class {
        struct objc_class *isa;
    };
    

    So now we have a struct that points to its own type. But why you ask?

    Taken from Inside the Objective-C Runtime, Part 2

    The Class pointed to by the Class’ isa (the Class’ Class) contains the
    Class’ class methods in its objc_method_list. Got that? The
    terminology used in the runtime is that while an object’s isa points
    to its Class, a Class’s isa points to the object’s “meta Class”.

    So what about a meta Class’ isa pointer? Well, that points to the root
    class of the hierarchy (NSObject in most cases). (In the Foundation
    framework each meta class of a subclass of NSObject “isa” instance of
    NSObject.) And yes, by the way, NSObject’s meta Class’ isa points back
    to the same struct — it’s a circular reference so no Class’ isa is
    ever NULL.


    So according to that description when you create a class inheriting from NSObject you have an isa that points to its class type which points to its meta class which points to its root class (NSObject) which contains a circular reference to itself. This explains the reason why it requires two steps to determine if an object is an instance or a class.

    Lets say you create the following class:

    @interface MyClass : NSObject
    @end
    @implementation MyClass
    @end
    

    If you were able* to traverse the isa pointer you would get the following:
    *You can not since the isa is protected. See Cocoa with Love post below for creating your own implementation.

    Class c = myClassInstance->isa; //This would be the MyClass
    c = c->isa; //This would be MyClass' meta class
    c = c->isa; //This would be NSObjects meta class
    c = c->isa; //This going forward would still be the NSObjects meta class
    ...
    

    Once c == c->isa you will know you are at the root object. Remember that Objective-C is a proper superset of C, which does not natively have object-oriented constructs such as inheritance. This along with other implementation details, such as pointers to super classes which make up the full class hierarchy, allows Objective-C to provide object-oriented features. For more information on classes and meta-classes see the post on Cocoa with Love: What is a meta-class in Objective-C?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Undefined symbols for architecture i386: _OBJC_CLASS_$_CLLocationManager, referenced from: objc-class-ref in RootViewController.o _kCLLocationAccuracyNearestTenMeters, referenced from:
I received the following error: Undefined symbols: _OBJC_CLASS_$_SurveyDelegate, referenced from: objc-class-ref-to-SurveyDelegate in Menus.o ld:
xcode gives me that error: Undefined symbols for architecture i386: _OBJC_CLASS_$_MPVolumeView, referenced from: objc-class-ref
_OBJC_CLASS_$_CustomerNameViewController, referenced from: objc-class-ref-to-CustomerNameViewController in Kunden.o I am getting this error even i have
_OBJC_CLASS_$_SBJSON, referenced from: Objc-class-ref in JparseViewController.o Symbol(s) not found for architecture i386 Clang: error:
I am using location manager Undefined symbols for architecture i386: _OBJC_CLASS_$_CLLocationManager, referenced from: objc-class-ref
_OBJC_CLASS_$_NSFetchedResultsController, referenced from: objc-class-ref-to-NSFetchedResultsController in RootViewController.o I'm getting 7 of the errors above in
I got this error from XCode: objc[8422]: FREED(id): message release sent to freed object=0x3b120c0
Im an Android noob, coming from objC, I have a very stupid question (project
Lets say I have this enum defined (from Apple's UIKit framework): typedef enum {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.