gnustep-dev
[Top][All Lists]
Advanced

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

Re: Windows, DLLs and NSBundle


From: Ovidiu Predescu
Subject: Re: Windows, DLLs and NSBundle
Date: Fri, 05 Jan 2001 11:43:46 -0800

Do not use NSLog inside +load, use printf instead!

NSLog relies on lots of other classes, including NSString which is a class
cluster e.g. it's really using many other classes instead, to function
correctly. This may not work in all the cases as at the time you want to use
NSLog the NSString classes may not be loaded.

Read the documentation that comes with libobjc to see what are the limitations
when using +load. It's very important that you understand how +load works
before you do anything.

Regards,
-- 
Ovidiu Predescu <address@hidden>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://www.geocities.com/SiliconValley/Monitor/7464/


On Fri, 05 Jan 2001 10:57:21 +0100, Michael Scheibler 
<address@hidden> 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
> 
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gnustep-dev
> 





reply via email to

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