Subject: Re: objective c compiler problems
To: None <dave@turbocat.de>
From: Brook Milligan <brook@biology.nmsu.edu>
List: netbsd-help
Date: 03/12/2000 23:35:21
   > I'm working on a NetBSD package that makes use of objective c.  Is
   > there anyone familiar enough with that language and the gcc
   > implementation who could help me debug a couple of problems?

   I use gcc version 2.95.2 19991024 (release). That works but I have not  
   managed to get threads and shared libs in GNUstep working. Most of the  
   GNUstep people use Linux or some other OS and until now, I have found noone  
   who can help here.

I've narrowed down the source of the runtime error I get to the
following code fragment in /usr/src/gnu/dist/gcc/objc/class.c:

     /* This is a hook which is called by objc_get_class and 
	objc_lookup_class if the runtime is not able to find the class.
	This may e.g. try to load in the class using dynamic loading */
     Class (*_objc_lookup_class)(const char* name) = 0;      /* !T:SAFE */

     /* ... stuff deleted ... */

     /* Get the class object for the class named NAME.  If NAME does not
	identify a known class, the hook _objc_lookup_class is called.  If
	this fails,  an error message is issued and the system aborts */
     Class
     objc_get_class (const char *name)
     {
       Class class;

       objc_mutex_lock(__objc_runtime_mutex);

       /* Make sure the class hash table exists.  */
       assert (__objc_class_hash);

       class = hash_value_for_key (__objc_class_hash, name);

       objc_mutex_unlock(__objc_runtime_mutex);

       if (class)
	 return class;

       if (_objc_lookup_class)
	 class = (*_objc_lookup_class)(name);

       if(class)
	 return class;

       objc_error(nil, OBJC_ERR_BAD_CLASS, 
		  "objc runtime: cannot find class %s\n", name);
       return 0;
     }

I get the "cannot find class ..." error upon running the program.
Presumably, the shared libraries are supposed to be loaded by the
_objc_lookup_class() function, but there is no implementation for it.

Is this something that the compile should provide?

Is this something the OS should provide (e.g., via dlopen() and
friends)?

Can anyone give me guidance about where to look for help in getting
shared libraries loaded in Objective C?

Thanks for your help.

Cheers,
Brook