Tcl Source Code

View Ticket
Login
Ticket UUID: 3159088
Title: lazy bindings for dynamic loading
Type: RFE Created on: 2011-01-16 04:27:59
Submitter: anyeli Assigned to: nijtmans
Subsystem: 40. Dynamic Loading Severity:
Priority: 5 Medium Last modified: 2013-01-02 22:20:06
Status: Closed Closed by: nijtmans
Resolution: Fixed Closed on: 2013-01-02 15:20:06
Version: None
Description:
I would like to have the option of having the dynamic loader perform lazy binding.

As of Tcl 8.5.9, the UNIX implementation of dynamic loading always passes RTLD_NOW to dlopen().
I want to build an extension that links to a dynamic library without having to link to an exact (or maximum)
version of the library.  With RTLD_NOW, if the library I link to is missing some symbols, I cannot load
the library at all if it is missing any symbols.  With RTLD_LAZY, I could link to the library missing symbols,
and avoid referencing them by using run-time version checks.  I do not know of a way of doing the same
thing with RTLD_NOW without a lot of extra work.
User Comments:
nijtmans added on 2012-10-22 19:21:49:

allow_comments - 1

See: TIP #357 <http://tip.tcl.tk/357>

The "load" command is not meant to load external
libraries, only Tcl extensions. However using the TIP #357
Tcl_LoadFile (for the minimal required functions)
followed by Tcl_FindSymbol (for the optional symbols)
you should be able to do this. That's
the recommended way.

nijtmans added on 2012-11-08 19:24:53:

allow_comments - 0

See: <http://www.tcl.tk/cgi-bin/tct/tip/416>

The use case you are presenting is exactly one described in this TIP

nijtmans added on 2013-01-02 22:20:06:

allow_comments - 1

Fixed in Tcl 8.6