Re: Hard Objc-Runtime question: objc_getClassList lies to me...
Re: Hard Objc-Runtime question: objc_getClassList lies to me...
- Subject: Re: Hard Objc-Runtime question: objc_getClassList lies to me...
- From: Martin Häcker <email@hidden>
- Date: Fri, 25 Jul 2003 08:42:01 +0200
If the class you are looking for in that set is in a loadable bundle,
the the bundle will not be loaded until required. The Mach-o
runtime adds the required shared libraries to your executable
image at startup time. It does not, however, do any additional
work until needed. It does not load the resource from disk
into memory and do runtime linking to resolve symbols to
the point to the now valid resources in memory. If the
bundle contains objective-c resources the runtime system
cannot know about them yet.
I thought this too at first, but it tourned out not to be the case
for me. In my case it was Zero-Link that didn't bother to load the
class until needed.
If you had done something like, [ClassLister className], or
made any other reference which would cause the bundle to
be loaded. Then the objective c runtime would be passed a
reference to the classes, methods, and desciptions of instance
variables, etc. and you wouldn't have this problem. So, If you
need access to this information before creating any instances
or calling a class method, you'll have to make sure the containing
bundle is loaded on your own. NSBundle does this.
Well, I tried that... :) I tried "NSBundle mainBundle load" but that
didn't make me fly, thanks or the hint about prinzipal class thought
I am sure I can put that to good use. :)
That actually sounds pretty cool, as you could load classes,
interrogate them about the methods they respond to,
and potentially do useful work without ever knowing
at the time you were compiled, what kind of objects
you are loading from the bundle. Wow.
<g> Actually that's exactly what I'm doing.
Though I have a some very special Ideas what classes I want to find,
because I want to search the App-Space for all Unit-Tests and run
them automatically whithout ever having have a list somewhere where
every class is listed and which I need to hold up to date to have all
tests listed.
I'm curious to know if -load was sufficient or you need
- principleClass, before the objc runtime gets informed.
So, load wasn't enough and I haven't tried this prinzipal class stuff
since I identified ZeroLink as the culprit. (in my case)
Thanks a lot for your time though!
cu Martin
--
dont.wanna.tell
[ot]coder - hehe
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.