Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9848b87eda778662915dc7dbc8ff13d9114b16a8
Ticket: 1961211fffffffffffffffffffffffffffffffff
TclpDlopen failing on MacOSX 10.4 and later
User & Date: nijtmans on 2008-05-13 15:17:56
Changes

  1. icomment:
    Logged In: YES 
    user_id=61031
    Originator: NO
    
    2008/5/9 SourceForge.net <[email protected]>:
    >  However, the call to dlopen is problematic:
    >   dlHandle = dlopen(nativePath, RTLD_NOW | RTLD_LOCAL);
    >
    >  RLTD_LOCAL is *not* the default value for dlopen, the default is RTLD_GLOBAL. RLTD_LOCAL prevents Tcl/Tk from being able to load any dynamic library/module which depends (i.e. was linked against) a previously loaded dynamic library/module.
    >
    >  Unless I missed the rational for picking RLTD_LOCAL, could Tcl/Tk please use the default RLTD_GLOBAL?
    
    Generally, undefined symbols in libraries are a bad idea, because at
    run-time those unresolved symbols must
    be resolved. Therefore, RLTD_LOCAL is faster but has the disadvantage
    that all libraries must know which
    other libraries they depend on. In my view, RLTD_LOCAL is prefered
    whenever possible.
    
    >  In the second case, a library/module A will load correctly but will hide its symbols. Tcl/Tk will fail to load a library/module B if B depends on symbols in A (i.e. was dynamically linked against A).
    
    The 'correct' way to solve this is make sure that when compiling B,
    make sure to add '-lA' to the link line, then B will
    see the symbols. Additional advantage: loading B will load A
    automatically when it is not already done.
    
    >  I'll try to track down where the decision to use RLTD_LOCAL came from but
    >  at first glance I agree that this appears to be a bug, thanks for the
    >  report.
    
    Because tclLoadDl uses RLTD_GLOBAL as well, probably there are already
    libraries out there who
    fail to indicate all linked libraries. Therefore, I would recommend to
    change it to RLTD_GLOBAL
    in tclLoadDyld.c as well. However, I suggest to change it to
    RLTD_LOCAL in Tcl 8.6, and
    document the change clearly.
    
    Regards,
              Jan Nijtmans
    
    
  2. login: "nijtmans"
  3. mimetype: "text/plain"
  4. username: "nijtmans"