Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9faf8cbe06084dcdc48a9295c2a5a5b2d20d3f68
Ticket: 218734ffffffffffffffffffffffffffffffffff
tclstub81.lib locks me into release build only
User & Date: nobody on 2000-10-26 01:04:43
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1932 Bug
    Version: 8.1b3
    SubmitDate: '1999-04-26'
    LastModified: '1999-04-27'
    Severity: SER
    Status: Released
    Submitter: pat
    ChangedBy: stanton
    OS: Windows NT
    OSVersion: 4.0sp4 and MSVC++ v5
    Machine: X86
    FixedDate: '1999-04-27'
    FixedInVersion: 8.1
    ClosedDate: '1999-04-27'
    
    
    Name:
    
    David Gravereaux
    
    
    
    Comments:
    
    Rebuilding tclstub81.lib for all 4 combinations would seem to be the
    
        solution, and I'll try that now, but I should not have to rebuild
    
        components of Tcl to program extensions for it.
    
        
    
        I don't know what the solution is for the tclStubsPtr variable's name
    
        decoration.
    
    
    
    ReproducibleScript:
    
    The following test code cannot link with tclstub81.lib .  tclstub81.lib
    
        appears to have been built using the release msvcrt.dll .  I cannot
    
        staticly link my extension to the C run-time, either.
    
        
    
        Not only that, but tclStubsPtr is being decorated by the MSVC++
    
        compiler.
    
        
    
        --- begin CppTclExtTest.cpp ---
    
        #define WIN32_LEAN_AND_MEAN
    
        #include <windows.h>
    
        
    
        #define USE_TCL_STUBS
    
        #include "c:/progra~1/Tcl/include/tcl.h"
    
        #pragma comment(lib,"c:/progra~1/Tcl/lib/tclstub81.lib")
    
        
    
        BOOL WINAPI DllMain(HINSTANCE, ULONG, LPVOID) {
    
          return TRUE;
    
        }
    
        
    
        
    
        // forward reference
    
        class CTest;
    
        
    
        // used by all the Tcl commands to speed execution
    
        // by storing its member function location in the
    
        // clientdata on command creation.
    
        typedef struct {
    
          CTest *ext;
    
          int (CTest::*cmd)(int, struct Tcl_Obj * CONST objv[]);
    
        } CMDINFO, *LPCMDINFO;
    
        
    
        
    
        class CTest {
    
        public:
    
          CTest(Tcl_Interp *interp) : m_interp(interp) {
    
            Tcl_CreateObjCommand(interp, "Test::test", CmdCallback,
    
                CmdInfo(&CTest::TestCmd), CmdDelete);
    
            Tcl_PkgProvide( interp, "SillyTest", "1.0.0" );
    
            Tcl_CallWhenDeleted(interp, DeleteInterpHandler, (ClientData)
    
        this);
    
            Tcl_CreateExitHandler(ExitHandler, (ClientData) this);
    
          };
    
          ~CTest() {
    
            Tcl_DeleteExitHandler( ExitHandler, (ClientData) this );
    
          };
    
          friend int CmdCallback(ClientData, Tcl_Interp *, int, struct Tcl_Obj *
    
        CONST []);
    
          friend void CmdDelete(ClientData);
    
          friend Tcl_InterpDeleteProc DeleteInterpHandler;
    
          friend Tcl_ExitProc ExitHandler;
    
        private:
    
          inline ClientData CmdInfo (int (CTest::*cmd)(int, struct Tcl_Obj *
    
        CONST objv[])) {
    
           LPCMDINFO stuff = new CMDINFO;
    
            stuff->ext = this;
    
            stuff->cmd = cmd;
    
            return (ClientData) stuff;
    
          };
    
          int TestCmd (int objc, struct Tcl_Obj * CONST objv[]) {
    
           Tcl_Obj *resultPtr = Tcl_GetObjResult(m_interp);
    
           char buf[33];
    
        
    
            sprintf(buf,"%d",this);
    
            Tcl_AppendStringsToObj(resultPtr, "Hi there from ",buf," !", NULL);
    
            return TCL_OK;
    
          };
    
          Tcl_Interp *m_interp;
    
        };
    
        
    
        
    
        static void DeleteInterpHandler (ClientData clientData, Tcl_Interp
    
        *interp) {
    
         CTest *extension = (CTest *)clientData;
    
          delete extension;
    
        };
    
        
    
        static void ExitHandler (ClientData clientData) {
    
         CTest *extension = (CTest *)clientData;
    
          delete extension;
    
        };
    
        
    
        
    
        static int CmdCallback (ClientData clientData, Tcl_Interp *, 
    
                                int objc, struct Tcl_Obj * CONST objv[])
    
        {
    
         LPCMDINFO stuff = (LPCMDINFO)clientData;
    
        
    
          // We aleady know what the interp pointer is,
    
          // so don't bother with it.
    
        
    
          // Call the member function of the extension instance
    
          // as saved in the clientdata pointer ;)  Think of
    
          // this as a demultiplexor
    
          return ((stuff->ext)->*(stuff->cmd))(objc,objv);
    
        };
    
        
    
        static void CmdDelete(ClientData clientData) {
    
         LPCMDINFO stuff = (LPCMDINFO)clientData;
    
          delete stuff;
    
        };
    
        
    
        
    
        extern "C" __declspec( dllexport )
    
        #ifdef _DEBUG
    
        int CppTclExtTestd_Init (Tcl_Interp *interp) {
    
        #else
    
        int CppTclExtTest_Init (Tcl_Interp *interp) {
    
        #endif
    
          if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
    
            return TCL_ERROR;
    
          }
    
          try {
    
            new CTest(interp);
    
          }
    
          catch (char *msg) {
    
            MessageBox(NULL, msg, "Test extension ERROR!",
    
        MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
    
            return TCL_ERROR;
    
          }
    
          return TCL_OK;
    
        };
    
        --- end CppTclExtTest.cpp ---
    
    
    
    ObservedBehavior:
    
    --------------------Configuration: CppTclExtTest - Win32
    
        Debug--------------------
    
        Compiling...
    
        CppTclExtTest.cpp
    
        Linking...
    
           Creating library Debug/CppTclExtTest.lib and object
    
        Debug/CppTclExtTest.exp
    
        LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other
    
        libs; use /NODEFAULTLIB:library
    
        CppTclExtTest.obj : error LNK2001: unresolved external symbol "struct
    
        TclStubs *  tclStubsPtr" (?tclStubsPtr@@3PAUTclStubs@@A)
    
        Debug/CppTclExtTest.dll : fatal error LNK1120: 1 unresolved externals
    
        Error executing link.exe.
    
        
    
        CppTclExtTest.dll - 2 error(s), 1 warning(s)
    
    
    
    DesiredBehavior:
    
    a clean link
    
    
    
    
    
    The name decoration issue has been resolved.
    
    The linking issue can be resolved by using the /nodefaultlib:msvcrt flag when linking against the stub library.
    04/27/1999 14:06 - stanton -
    
    
    
  4. foundin changed to: "obsolete: 8.1b3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "tclstub81.lib locks me into release build only"
  11. type changed to: "Bug"