gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows, DLLs and NSBundle


From: Michael Scheibler
Subject: Re: Windows, DLLs and NSBundle
Date: Fri, 05 Jan 2001 11:18:37 +0100

I am using gcc-2.95.2, mingwin.
I was just looking at the source code of objc_exec_class, and in fact
there is the call to _objc_load_callback. Now I will try to debug the
code.

Michael

Helge Hess wrote:
> 
> Hi,
> 
> I can only say that it works for me without any problems, at least in
> Cygwin with libFoundation (and we heavily rely on loadable bundles and
> the objc_load_callback/NSBundleDidLoad).
> Which libobjc do you use ?
> 
> Helge
> 
> Michael Scheibler wrote:
> >
> > Yes, I know it should be invoked. But I inserted an NSLog statement
> > inside objc-load's objc_load_callback function: nothing. I also got the
> > notification, but the class name is nil (which of course can't have any
> > class name without this callback routine working).
> >
> > Michael
> >
> > Helge Hess wrote:
> > >
> > > Hi,
> > >
> > > If you use NSBundle you should even be able to get a NSBundleDidLoad
> > > Notification which includes the loaded classes and categories. At least
> > > this works with libFoundation (which overrides the callback during
> > > bundle loading) and MacOSX.
> > >
> > > Helge
> > >
> > > Adam Fedor wrote:
> > > >
> > > > Michael Scheibler wrote:
> > > > >
> > > > > Ok, I was (finally!) able to load a DLL using NSBundle. The ObjC-class
> > > > > inside this DLL is automatically initialized by its load-method. Now 
> > > > > it
> > > > > would be nice to know what classes are inside.
> > > > > I found a callback function in objc-load.m (objc_load_callback) and
> > > > > found following lines in objc-api.h of gcc:
> > > > >
> > > > > /*
> > > > > ** This is a hook which is called by __objc_exec_class every time a
> > > > > class
> > > > > ** or a category is loaded into the runtime.  This may e.g. help a
> > > > > ** dynamic loader determine the classes that have been loaded when
> > > > > ** an object file is dynamically linked in.
> > > > > */
> > > > > extern void (*_objc_load_callback)(Class class, Category* category);
> > > > >
> > > > > Unfortunately this function is never invoked. Can you tell me why, or
> > > > > where I can change the code for it?
> > > > >
> > > > It should be invoked. objc_load_module should set _objc_load_callback to
> > > > the local function objc_load_callback. Anytime the Objective-C rurntime
> > > > loads a module containing classes, it should call this function for each
> > > > class and category. You might have to trace the program from
> > > > objc_load_module to make sure the callback is really getting setup
> > > > correctly.
> > >
> > > --
> > > SKYRIX Software AG - http://www.skyrix.com
> 
> --
> SKYRIX Software AG - http://www.skyrix.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]