Re: Where to find _objc_insertMethods
Re: Where to find _objc_insertMethods
- Subject: Re: Where to find _objc_insertMethods
- From: Greg Parker <email@hidden>
- Date: Mon, 6 Jun 2005 15:37:09 -0700
On Jun 6, 2005, at 3:11 PM, Bill Greene wrote:
Does the runtime distinguish between methods that are categories
and those that are not? If so, how is it informed of this? My
initial guess was that the objc_category structure in <objc/objc-
class.h> had to be filled in by the compiler much as the
objc_method_list structure must be filled in before calling
class_addMethods.
The runtime makes almost no such distinction. A category is little
more than a list of methods in an image that should be added to some
class when the library is loaded. Once the library is loaded and the
methods attached by the runtime, the existence of the category itself
is forgotten. Methods added via any mechanism work the same way, and
are indistinguishable from each other or the class's "real" methods
in practice.
The compiler does build objc_category structures, which the runtime
discovers by way of the Module and Symtab structures. You shouldn't
need to use them unless you're trying to build images on disk that
look like the Objective-C compiler's output.
There is one small difference between methods added using a category
and methods added using class_addMethods(). If a category includes a
+load method, the runtime calls that method after processing the
category. Nothing special happens with a +load method added using
class_addMethods().
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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