On 6 Jan 2010, at 15:06, 荒田 実樹 wrote:
> I managed to make my code that dynamically adds a class work.
> Following fixes were needed:
> - CLS_SETRESOLV on cls and metaClass in objc_registerClassPair.
Instead, I am calling __objc_resolve_class_links(), which should do
this. I'm also no longer setting the initialized flag, so hopefully
the runtime will now call +initialize correctly in runtime-added
classes. Please test this.
> - class_getSuperclass directly refer to cls->super_class
> (class_get_super_class doesn't work on metaclass).
I've now fixed class_get_super_class() in libobjc2. This also fixes a
couple of other weird bugs (e.g. throwing a constant string literal as
an exception before sending a message to a constant string breaks in
the GCC runtime, but now works correctly in libobjc2).
> In objc_allocateClassPair:
> - Set newClass->instance_size to super->instance_size.
Done.
> - Set metaClass->super_class to super->class_pointer, not superclass-
>> class_pointer->super_class.
Ooops. Well spotted.
> - Set metaClass->class_pointer to objc_get_class("Object")-
>> class_pointer (superclass->class_pointer->class_pointer can be used
> instead).
Hmm. For Apple-compatibility we should be setting it to NSObject. I
wonder if that would break GNUstep...
By the way, if you've got a decent set of tests for this API then they
would be very helpful...
David
-- Sent from my Cray X1
_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss