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

Re: gEDA: Re: dllopen args problem (PR#360)



On Tue, Jan 22, 2002 at 06:55:52PM -0800, Stephen Williams wrote:
> 
> 
> adyer@enteract.com said:
> > the fix is to change RTLD_NOW to RTLD_LAZY.
> 
> I need a pre-processor way to detect this situation and compile
> in the correct implementation. Any suggestions?

I looked up the 'single unix' spec for this at http://www.opengroup.org/onlinepubs/7908799/xsh/dlopen.html and it says:

   The mode parameter describes how dlopen() will operate upon file with
   respect to the processing of relocations and the scope of visibility
   of the symbols provided within file. When an object is brought into
   the address space of a process, it may contain references to symbols
   whose addresses are not known until the object is loaded. These
   references must be relocated before the symbols can be accessed. The
   mode parameter governs when these relocations take place and may have
   the following values:
   
   RTLD_LAZY
   
   Relocations are performed at an implementation-dependent time, ranging
   from the time of the dlopen() call until the first reference to a
   given symbol occurs. Specifying RTLD_LAZY should improve performance
   on implementations supporting dynamic symbol binding as a process may
   not reference all of the functions in any given object. And, for
   systems supporting dynamic symbol resolution for normal process
   execution, this behaviour mimics the normal handling of process
   execution.
   
   RTLD_NOW
   
   All necessary relocations are performed when the object is first
   loaded. This may waste some processing if relocations are performed
   for functions that are never referenced. This behaviour may be useful
   for applications that need to know as soon as an object is loaded that
   all symbols referenced during execution will be available.


Maybe just change everybody over to RTLD_LAZY?


-- 
"The sooner you fall behind, the more time you'll have to catch up!"