+static void
+__objc_call_load_callback (struct objc_module *module)
+{
+ if (_objc_load_callback)
+ {
+ /* The runtime mutex is locked at this point. */
+ struct objc_symtab *symtab = module->symtab;
+ int i;
+
+ /* Iterate thru classes defined in this module and call the callback
+ for each one. */
+ for (i = 0; i < symtab->cls_def_cnt; i++)
+ {
+ Class class = (Class) symtab->defs[i];
+
+ if (!objc_hash_is_key_in_hash (duplicate_classes, class))
+ {
+ /* Call the _objc_load_callback for this class. */
+ DEBUG_PRINTF (" calling the load callback for class '%s'\n", class->name);
+ _objc_load_callback (class, 0);
+ }
+ }
+
+ /* Call the _objc_load_callback for categories. Don't register
+ the instance methods as class methods for categories to root
+ classes since they were already added in the class. */
+ for (i = 0; i < symtab->cat_def_cnt; i++)
+ {
+ struct objc_category *category = symtab->defs[i + symtab->cls_def_cnt];
+ Class class = objc_getClass (category->class_name);
+
+ DEBUG_PRINTF (" calling the load callback for category '%s (%s)'\n",
+ category->class_name, category->category_name);
+ _objc_load_callback (class, category);
+ }