Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by Frank Hartlep
Mon, 14 Sep 1992 13:04
Loading classes at run-time: How?
Author: Frank Hartlep
Date: Mon, 14 Sep 1992 13:04
Date: Mon, 14 Sep 1992 13:04
14 lines
1264 bytes
1264 bytes
I do not want to use the objc_{load,unload}Module routines because
of their FIFO behaviour. Just loading the class file with rld isn't
enough, my app still complains 'class MyClass not linked into application'.
I can only guess why it reacts like that: There's a hash table containing
the Class structures of all classes known to the app, and by trying
objc_getClass ("MyClass") I get the same error message. So I suppose I
have to insert MyClass into the table by hand. This can be done with
objc_addClass (). The only problem is that I can't find any way to
obtain the Class structure of MyClass, which I need as an argument for
objc_addClass (). Any ideas from where to get this little beast?
Frank
mauriti@cs.tu-berlin.de
Re: Loading classes at run-time: How?
Author: Frank Hartlep
Date: Tue, 15 Sep 1992 13:47
Date: Tue, 15 Sep 1992 13:47
19 lines
1656 bytes
1656 bytes
In article <TA168WJ@mailgzrz.tu-berlin.de>, mauriti@cs.tu-berlin.de (Frank Hartlep) writes:
> I do not want to use the objc_{load,unload}Module routines because
> of their FIFO behaviour. Just loading the class file with rld isn't
> enough, my app still complains 'class MyClass not linked into application'.
> I can only guess why it reacts like that: There's a hash table containing
> the Class structures of all classes known to the app, and by trying
> objc_getClass ("MyClass") I get the same error message. So I suppose I
> have to insert MyClass into the table by hand. This can be done with
> objc_addClass (). The only problem is that I can't find any way to
> obtain the Class structure of MyClass, which I need as an argument for
> objc_addClass (). Any ideas from where to get this little beast?
Found the solution yesterday:
getsectdatafromheader (MyMachHeader, "__OBJC", "__class", &Size) returns
a pointer to an array of Class structs defining the loaded classes.
If somebody's interested in example code showing how to load/unload
classes in a random order, I'll post it.
Frank
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads