|
2012-11-15
| ||
| 17:53 | • Closed ticket [3579001fff]: Allow user choice for RTLD_GLOBAL / RTLD_LOCAL p... artifact: 55c2c64b99 user: nijtmans | |
|
2012-11-02
| ||
| 20:32 | • Ticket [3579001fff]: 5 changes artifact: fefef5a243 user: nijtmans | |
|
2012-10-25
| ||
| 04:31 | • Ticket [3579001fff]: 4 changes artifact: 9cb277f9d2 user: nijtmans | |
|
2012-10-24
| ||
| 20:43 | • Ticket [3579001fff]: 4 changes artifact: 02e259cf17 user: anonymous | |
| 20:11 | • Ticket [3579001fff]: 5 changes artifact: 50d36b1174 user: nijtmans | |
| 05:02 | • Ticket [3579001fff]: 4 changes artifact: 5acf43805b user: nijtmans | |
| 00:15 | • Ticket [3579001fff]: 4 changes artifact: bccbe3247a user: anonymous | |
|
2012-10-23
| ||
| 15:04 | • Ticket [3579001fff]: 4 changes artifact: 2ce8d2ba96 user: nijtmans | |
| 07:43 | • Ticket [3579001fff]: 1 change artifact: 6a2eda6b6c user: anonymous | |
| 07:41 | • Open ticket [3579001fff]. artifact: 80108edc96 user: anonymous | |
|
2012-10-22
| ||
| 19:28 | • Pending ticket [3579001fff]. artifact: 7758d73dbf user: nijtmans | |
| 19:26 | • Ticket [3579001fff]: 4 changes artifact: a931ce9dc5 user: dkf | |
| 13:56 | • Ticket [3579001fff]: 1 change artifact: f6f10b70a7 user: nijtmans | |
| 00:51 | • New ticket [3579001fff]. artifact: d590b1776a user: anonymous | |
Allow user choice for RTLD_GLOBAL / RTLD_LOCAL
Closed / Fixed3579001fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2012-10-22 00:51:23
This is similar to the feature request artifact id 3159088.
It would be very useful to allow users to control the flags passed to dlopen() when calling Tcl's load command.
One suggestion would be to add an optional -flags argument that accepts a list of values similar to the open command. Ex.
load myextension.so -flags { RTLD_GLOBAL RTLD_LAZY }
nijtmans Ticket [3579001fff]: 1 change
[History diff]2012-10-22 13:56:40
dkfplain2012-10-22 19:26:23
I'm not necessarily opposed to this, but I would note that this requires care because of the differences between different [load] implementations (if only it was always libdl…)
nijtmansplain2012-10-22 19:28:32
1) Those flags are only available on UNIX, how should it be implemented on Windows/AIX/HP/....?? 2) The Tcl "load" command is only meant to load Tcl extensions, which typically export only Xxx_Init and maybe one or two more. I don't see that advantage that RTLD_GLOBAL/RTLD_LAZY would provide there.
plain2012-10-23 07:41:48
This feature is very important for extensions that provide Tcl bindings to C++ interfaces. The extension links with the underlying C++ shared libs, and can behave badly if it is loaded with local symbol scoping (two copies of the same static variable in two different extensions). Other multi-platform scripting languages provide users with a way to control the flags passed to dlopen() on Unix platforms. For example: python (ctypes module) perl (sub dl_load_flags) ruby (DL module) Since some extensions behave badly with local symbol scoping and some behave badly with global, it makes sense to give the programmer the opportunity to choose between the two, depending on the application. It's fine if this is a Unix-only feature, as long as the documentation describes it as such.
anonymous Ticket [3579001fff]: 1 change
[History diff]2012-10-23 07:43:01
nijtmansplain2012-10-23 15:04:02
Understood. So it's really a -global flag you are after.
plain2012-10-24 00:15:00
Thank you for your consideration. Yes, my primary concern is the ability to specify -global. However, RTLD_LAZY is also very useful for similar applications that provide C++ scripting bindings for Tcl. By being able to speciy lazy loadng, packages can work correctly with multiple versions of the underlying C++ shared libs. A user could use a newer build of the scripting API with an older version of the C++ shared libs, but would not run into missing symbol errors unless he or she actually tried invoking code belonging to the new API. Of course, this is also very application specific and would not be desirable in all situations. So, it makes sense to keep the default as-is now and provide an option for the programmer to select what is best for the application. Since these two features are closely related, I thought it would make sense to combine them into one request. But of course, my main concern is the ability to control global / local.
nijtmansplain2012-10-24 05:02:56
I did some preparation for this on the Tcl trunk. See:
http://core.tcl.tk/tcl/info/4d417791c9
This makes it trivial to implement this Feature request, on
top of TIP #357: Export TclLoadFile. The only things
that is left to do is define the meaning of the "flags"
parameter, and translate that as needed in the
various tclLoad*.c implementations.
Still another TIP is needed to complete it, because
it modifies the "load" command. It could be integrated
with TIP #239: "Enhance the 'load' Command"
<http://www.tcl.tk/cgi-bin/tct/tip/239.html>
as well.
I don't think this will make Tcl 8.6, it certainly
should not delay the Tcl 8.6 release.......
nijtmansplain2012-10-24 20:11:40
experimental implementation in branch "frq-3579001)". See:
<http://core.tcl.tk/tcl/info/0895bccd51>
test-cases are updated, but nothing has been done on documentation yet.
New syntax:
load fileName ?-global? ?-lazy? ?packageName? ?interp?
plain2012-10-24 20:43:05
Thank you very much for your work here. Is there anything that I can do to help?
nijtmansplain2012-10-25 04:31:53
Changed syntax in "frq-3579001" branch: It's more logical to expect the options before the filename. cdelbaere, what is your email address? Please mail it privately to me.
nijtmansplain2012-11-02 20:32:32
Test report from Christian: Hi Jan, I performed some manual testing on the new implementation of the load command using a set of loadable modules in a software package that I am working on. I can tell by the behavior of some of my internal testcases which flags are passed to dlopen(). All of the following combinations work as expected: load module.so load -global module.so load -lazy module.so load -global -lazy module.so load -lazy -global module.so Also, load -- module.so load -global -- module.so load -lazy -- module.so load -lazy -global -- module.so The default is still local + now symbol loading (correct) The -global flag loads the libraries symbols with global scoping (correct) The -lazy flag correctly ignores missing symbols until the code is actually called (correct) Regards, Christian
nijtmansplain2012-11-15 17:53:42
allow_comments - 1 Implementation is on trunk now, to be released with Tcl 8.6.0
Log in (anonymous is fine) to add a comment.