Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_InitStubs() not usable in tcl81.dll

Closed / Out of Date219174ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
Descriptionplain2000-10-26 05:02:50
OriginalBugID: 1841 Bug
Version: 8.1b3
SubmitDate: '1999-04-15'
LastModified: '1999-04-21'
Severity: LOW
Status: Assigned
Submitter: pat
ChangedBy: redman
RelatedBugIDs: 1842
OS: Windows NT
OSVersion: 4.0 SP3
Machine: X86
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:

Jan Nijtmans



Comments:

The supplied patch does 3 things:

    - Change the TCL_STORAGE_CLASS of Tcl_InitStubs to be empty,

      in exactly the same was as for Tcl_AppInit(). This prevents

      the Tcl_InitStubs function to be exported from tcl81.dll

    - Remove the Tcl_InitStubs() call from tclBasic.c (Windows only)

    - Remove tclStubLib.obj from the object list.

    The result of this is that tcl81.dll is somewhat smaller, and

    doesn't export Tcl_InitStubs() any more.



ReproducibleScript:

Build an extension with -DUSE_TCL_STUBS, and link it with tcl81.lib.

    This results in a few unresolved symbols, because on Windows

    global variables cannot be exported (without hacking the def-file)



ObservedBehavior:

Although this is really a bug in Windows, exporting the function

    Tcl_StubInit() suggests that linking against the lib-file works.

    Therefore I suggest to remove the Tcl_StubInit() function from

    tcl81.dll: it doesn't serve any function, except confusing some

    users why it is there anyway.



Patch:

*** generic/tcl.h.origWed Apr 14 22:17:41 1999

--- generic/tcl.hWed Apr 14 22:21:10 1999

***************

*** 1465,1493 ****

  #define TCL_STUB_MAGIC 0xFCA3BACF

  

  /*

-  * The following function is required to be defined in all stubs aware

-  * extensions.  The function is actually implemented in the stub

-  * library, not the main Tcl library, although there is a trivial

-  * implementation in the main library in case an extension is statically

-  * linked into an application.

-  */

- 

- EXTERN char *Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,

-     char *version, int exact));

- 

- #ifndef USE_TCL_STUBS

- 

- /*

-  * When not using stubs, make it a macro.

-  */

- 

- #define Tcl_InitStubs(interp, version, exact) \

-     Tcl_PkgRequire(interp, "Tcl", version, exact)

- 

- #endif

- 

- 

- /*

   * Include the public function declarations that are accessible via

   * the stubs table.

   */

--- 1465,1470 ----

***************

*** 1511,1516 ****

--- 1488,1506 ----

  #define TCL_STORAGE_CLASS

  

  EXTERN intTcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));

+ EXTERN char *Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,

+     char *version, int exact));

+ 

+ #ifndef USE_TCL_STUBS

+ 

+ /*

+  * When not using stubs, make it a macro.

+  */

+ 

+ #define Tcl_InitStubs(interp, version, exact) \

+     Tcl_PkgRequire(interp, "Tcl", version, exact)

+ 

+ #endif

  

  #endif /* RESOURCE_INCLUDED */

  

*** generic/tclBasic.c.origWed Apr 14 22:15:47 1999

--- generic/tclBasic.cWed Apr 14 22:17:30 1999

***************

*** 539,549 ****

       */

  

      Tcl_PkgProvideEx(interp, "Tcl", TCL_VERSION, (ClientData) &tclStubs);

!     

  #ifdef Tcl_InitStubs

  #undef Tcl_InitStubs

  #endif

      Tcl_InitStubs(interp, TCL_VERSION, 1);

  

      return interp;

  }

--- 539,551 ----

       */

  

      Tcl_PkgProvideEx(interp, "Tcl", TCL_VERSION, (ClientData) &tclStubs);

! 

! #ifndef __WIN32__    

  #ifdef Tcl_InitStubs

  #undef Tcl_InitStubs

  #endif

      Tcl_InitStubs(interp, TCL_VERSION, 1);

+ #endif

  

      return interp;

  }

*** win/makefile.vc.origWed Apr 14 22:21:20 1999

--- win/makefile.vcWed Apr 14 22:22:47 1999

***************

*** 183,189 ****

  $(TMPDIR)\tclScan.obj \

  $(TMPDIR)\tclStringObj.obj \

  $(TMPDIR)\tclStubInit.obj \

- $(TMPDIR)\tclStubLib.obj \

  $(TMPDIR)\tclThread.obj \

  $(TMPDIR)\tclTimer.obj \

  $(TMPDIR)\tclUtf.obj \

--- 183,188 ----



PatchFiles:

tcl.h tclBasic.c makefile.vc





4/22/99 - redman - After talking with Scott S., we're going to try another scheme to work around the problem described (exporting the symbols in question and removing the need to use -DUSE_TCL_STUBS).  This really isn't a critical issue and can wait.
dkf Ticket [219174ffff]: 1 change [History diff]2000-11-19 18:45:47
dkf Ticket [219174ffff]: 1 change [History diff]2001-02-08 21:59:43
andreas_kupries Ticket [219174ffff]: 1 change [History diff]2001-09-08 06:13:41
hobbsplain2002-03-23 04:53:23
Logged In: YES 
user_id=72656

I believe this is just way out of date, because things are 
working ok since 8.2.
Log in (anonymous is fine) to add a comment.