Artifacts Associated With Ticket 218734ffffffffff
Ticket change [9faf8cbe06] (rid 96681) by nobody on 2000-10-26 01:04:43:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized 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 - - foundin initialized to: "obsolete: 8.1b3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "tclstub81.lib locks me into release build only"
- type initialized to: "Bug"
Ticket change [fbddbe99e7] (rid 108133) by welch on 2000-10-26 08:28:12:
- closedate changed to: "2000-10-26T01:28:12"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [c0af77894c] (rid 102454) by dgp on 2001-04-17 06:02:50:
- closedate changed to: "2001-04-16T23:02:50"
- closer changed to: "dgp"
- subsystem changed to: "53. Configuration and Build Tools"