Tcl Source Code

View Ticket
Login
Ticket UUID: 219140
Title: patch for dynamic linking /HPUX / TCL8.0.3
Type: Bug Created on: 2000-10-26 05:02:14
Submitter: nobody Assigned to: kennykb
Subsystem: 40. Dynamic Loading Severity:
Priority: 5 Medium Last modified: 2001-04-10 06:11:03
Status: Closed Closed by: kennykb
Resolution: Fixed Closed on: 2001-04-09 23:11:03
Version: obsolete: 8.0.3
Description:
OriginalBugID: 704 RFE
Version: 8.0.3
SubmitDate: '1998-10-13'
LastModified: '2000-02-27'
Severity: MED
Status: Assigned
Submitter: admin
ChangedBy: hobbs
OS: HP-UX
OSVersion: NA
Machine: NA
FixedDate: '2000-10-25'
FixedInVersion: NA
ClosedDate: '2000-10-25'


The following patch allows shared libraries to be found
by the dynamic loader in the directories specified at linktime
with "-Wl,+s,+b,/usr/local/lib:." or at runtime
through the environment var "SHLIB_PATH".

Without that you have to use an absolute path in the
tcl "load" command


#pwd
/home/traum/tcltk/tcl8.0.3/unix
#diff tclLoadShl.c.orig tclLoadShl.c
63c63
<     handle = shl_load(fileName, BIND_IMMEDIATE, 0L);
---
>     handle = shl_load(fileName, DYNAMIC_PATH | BIND_IMMEDIATE, 0L);


Uwe Traum
IBB GDV

[email protected]


The args to this have changed since this report, and it is not
clear whether this is still necessary. (Was BIND_IMMEDIATE, now
is BIND_DEFERRED|BIND_VERBOSE). 
-- 08/06/1999 hobbs
User Comments:
tgl added on 2001-02-08 01:19:52:
Adding DYNAMIC_PATH *is* still necessary to make
dynamic library search paths work under HPUX.
I was about to submit a new bug report asking
for this flag to be added, but I see that there
are already two open bugs asking for that
(119140 and 117820).  Please do it for Tcl 8.4...

kennykb added on 2001-02-16 04:30:15:
I question whether this patch goes quite far enough.

Assume for the sake of argument that the user does "load foo.sl".

We certainly want to add DYNAMIC_PATH to the flags so that the SHLIB_PATH is used to search for libraries that are referenced from within "foo.sl".  That's what the patch does (once we merge the changes so that the flags are BIND_DEFERRED | BIND_VERBOSE | DYNAMIC_PATH).

But do we really want to search the SHLIB_PATH for the original "foo.sl" ?  The documentation of the "load" command says that it accepts a filename, and the "filename" man page is pretty clear about what Tcl's conventions are for filenames.  I'd think that rather than searching SHLIB_PATH, the initial load should go only after the working directory if the path name is relative.  We could achieve this by prepending the working directory name to any relative path that gets passed to TclpLoadFile before handing it off to shl_load.

Otherwise, I think it's practically certain that somewhere down the road, some user will do "load foo.sl" with a "foo.sl" in the working directory, but a SHLIB_PATH that doesn't contain '.', and submit a bug that it didn't load or loaded the wrong version.

Any comments from the HPUX users?

kennykb added on 2001-04-10 06:11:03:
Logged In: YES 
user_id=99768

The change in the shl_load flags has been committed to the HEAD.