| Article: |
Inside the Objective-C Runtime | |
| Subject: | Adding categories at runtime | |
| Date: | 2003-02-26 15:15:46 | |
| From: | eepstein | |
|
Response to: Adding categories at runtime
|
||
|
Yes, this can be done. You make calls directly into the runtime itself. I'll take a look to see if I've got an example hanging about and will post it here. The "trick" is telling the runtime to re-cache the methods for the class in question. This is done when a bundle is loaded, so the esaiest way to get this effect is to load the bundle with the methods you need... after all, unless you have the code pre-compiled into some other form (other than a bundle) or wrote in-line binary instructions (not recommended and very unportable), you had to have the code compiled at some point and may as well have put it into a bundle/framework. Then you just tell the Brundle/framework loader to load the bundle in question and the methods will appear. You can also, of course, implement a category method in any file that is linked into your executable and it will be available when the program is running.
|
||
Women in Technology
Hear us Roar
