From: Donald G P. <don...@ni...> - 2010-04-05 22:30:48
|
Donald G Porter wrote: >> [...] removing the global variable tclStubsPtr completely from the >> Tcl shared library. Reinhard Max wrote: > was there a speciffic reason for this removal? It grew out of the effort during 8.5 development to nail down in a more controlled manner what symbols are exported from the Tcl library. At one point in that effort, the global variable tclStubsPtr got marked as MODULE_SCOPE, and things broke. That raised the question "Why does the Tcl shared library have this variable in the first place?" and the project of making Tcl work without it was deferred to 8.6 development and taken up again as soon as 8.6 alpha work began in 2008. Since the workings of Tcl_InitStubs() depends on setting the value of a "tclStubsPtr" variable in the extension and not in the Tcl library, this is a simplification which also permits clearer instructions to be offered on "how to use stubs". Start with Tk Feature Request 1716117 and follow links to other Tracker items to follow the history of the discussion. > I've done some experiments in the past to pull Tcl into embedding > applications such as the browser plugin by dlsym()ing tclStubsPtr from > libtcl before calling any Tcl functions. That way applications can > have the same independence of the Tcl version as extensions. But with > the removal of tclStubsPtr from the shared lib this doesn't seem to be > possible anymore. Or is it possible for embedding applications to use > the stubs library? Any code using stubs, extension or embedding, follows the same recipe * compile with USE_TCL_STUBS * Make a call to Tcl_InitStubs() before other Tcl routines * link against the stubs library The Tcl_InitStubs() call needs a non-NULL interp passed to it. An extension gets the interp passed in to its Tcl_PackageInitProc. For an embedder wanting to dynamically load the Tcl library, I think it would involve a dlsym() to find and call Tcl_CreateInterp() to get that bootstrapping interp. Others more familiar with these matters are welcome to correct or extend my comments. -- | Don Porter Mathematical and Computational Sciences Division | | don...@ni... Information Technology Laboratory | | http://math.nist.gov/~DPorter/ NIST | |______________________________________________________________________| |