On 2010/01/07, at 7:29, David Chisnall 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.

It's not fixed.  In __objc_resolve_class_links, following part goes  
wrong:
 >              Class a_super_class
 >                = objc_get_class ((char *) class1->super_class);
Changing this to something like
 >              Class a_super_class
 >                = CLS_ISRUNTIME(class1)
 >                  ? class1->super_class
 >                  : objc_get_class ((char *) class1->super_class);
would work.  There may be a cleaner way that doesn't use  
CLS_ISRUNTIME, though.

> By the way, if you've got a decent set of tests for this API then they
> would be very helpful...

Actually, what I have is a bridge between a language and Obj-C that  
depends on the API.  It is rather dirty and complex...

Mizuki


_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à