I am writing an app a little bit like class-dump, as an educational
exercise in (a) Mac OS X Cocoa programming and (b) to learn what
things are actually available in the Cocoa API - it's an interesting
I've struck a problem however, with the discovery of formal
protocols. Quite likely, I am doing something silly.
My understanding of the obj-c meta information is such:
- - a class that implements a formal protocol, by declaring it in the
header and implementing that protocols methods - should have a Class
structure representing that [implemented] protocol in it's Class-
@interface MyClass : NSObject < TheProtocol >
- - the obj-c 'Class' structure contains a list of implemented [formal]
protocols, reachable by traversing the Class->protocols pointer.
- - protocols are simply 'struct objc_object' structures, i.e. classes
(once one traverses the objc_object->isa relationship)
My problem is that all the protocols I am traversing are called
'Protocol', and I can't seem to find the test protocol that I've
implemented to check this.
So, when I compile this into the rest of my app and start it up, I
call it for each and every class that is being discovered at runtime
- - and I see the following output:
[Session started at 2006-01-21 09:30:03 +0100.]
2006-01-21 09:30:04.823 SymbolExplorer caching protocol named:
2006-01-21 09:30:08.149 SymbolExplorer added 1502 items in this
2006-01-21 09:30:08.155 SymbolExplorer added 0 items in this scan
Which to me, is just plain wrong.
I've traced this through in the debugger, and can't see what I am
doing incorrectly. Anyone got an idea I can try? Is there a
compiler switch to use? (I'm using gcc 4 - but switching back to 3.3
makes no difference either).
Thanks everyone, any comments and discussion appreciated.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
-----END PGP SIGNATURE-----
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden