Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-24
05:25 • Closed ticket [219383ffff]: linking with tclstub8X.lib has a C-runtime flavor se... artifact: 172639dd3a user: hobbs
2001-04-21
05:41 • Ticket [219383ffff]: 4 changes artifact: 66cf81a8db user: davygrvy
2001-04-05
06:52 • Ticket [219383ffff]: 1 change artifact: 149618234a user: dgp
2000-10-26
05:12 • New ticket [219383ffff]. artifact: 5a534e0a62 user: nobody

linking with tclstub8X.lib has a C-runtime flavor set at com

Closed / Duplicate219383ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:12:04
OriginalBugID: 6073 RFE
Version: 8.1b3
SubmitDate: '2000-07-28'
LastModified: '2000-07-31'
Severity: LOW
Status: UnAssn
Submitter: davidg
ChangedBy: davidg
OS: All Windows
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


This always bugged me.  release/dynamic flavor only.  I got in the
habit of doing the following in my extension code:

#ifdef _MSC_VER
    // mark this .obj as needing tcl's Stubs library
#   pragma comment(lib, "tclstub84.lib")
    // the requirement for msvcrt.lib from tclstub84.lib should
    // be removed.
#   pragma comment(linker, "/nodefaultlib:msvcrt.lib")
#endif

So here's the "strip it at the source" fix so I don't have to keep
adding the strip at link-time for my extensions:

*** tclStubLib.c1999/05/25 01:00:271.4
--- tclStubLib.c2000/07/29 06:25:51
***************
*** 29,34 ****
--- 29,60 ----
  #include "tclPort.h"
  
  /*
+  * Remove the C-runtime #pragmas the previous headers insert.  The runtime
+  * flavor has no importance being encoded in the .obj and should not limit
+  * the use of the Stubs static library it's placed into.
+  */
+ #ifdef _MSC_VER
+ #   if defined(_MT) && defined(_DLL) && defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:msvcrtd.lib")
+ #   endif
+ #   if defined(_MT) && defined(_DLL) && !defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:msvcrt.lib")
+ #   endif
+ #   if defined(_MT) && !defined(_DLL) && defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:libcmtd.lib")
+ #   endif
+ #   if defined(_MT) && !defined(_DLL) && !defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:libcmt.lib")
+ #   endif
+ #   if !defined(_MT) && !defined(_DLL) && defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:libcd.lib")
+ #   endif
+ #   if !defined(_MT) && !defined(_DLL) && !defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:libc.lib")
+ #   endif
+ #endif
+ 
+ /*
   * Ensure that Tcl_InitStubs is built as an exported symbol.  The other stub
   * functions should be built as non-exported symbols.
   */



NOT!

maybe compile with no /Mxx switch so it defaults to /ML (ie. libc.lib)
then strip that with a single #pragma in the source.  It was messing
up my MFC project using /MD(d) striping.  Too bad there isn't a way
to not reference ANY runtime.  This really should be neutral. 
-- 07/29/2000 davidg

This is as neutral as I can get it.  noone EVER uses libc.lib, so we'll compile tclStubLib.c for that and strip it.  This way, any of the 4
multi-threaded flavors will not colide with it.

*** generic/tclStubLib.c1999/05/25 01:00:271.4
--- generic/tclStubLib.c2000/07/31 23:54:10
***************
*** 29,34 ****
--- 29,45 ----
  #include "tclPort.h"

  /*
+  * Remove the C-runtime #pragma (windows build) the compiler inserts.
+  * The runtime flavor has no importance being encoded in the .obj and should
+  * not limit the use of the Stubs static library it's placed into.
+  */
+ #ifdef _MSC_VER
+ #   if !defined(_MT) && !defined(_DLL) && !defined(_DEBUG)
+ #pragma comment (linker, "-nodefaultlib:libc.lib")
+ #   endif
+ #endif
+ 
+ /*
   * Ensure that Tcl_InitStubs is built as an exported symbol.  The other stub
   * functions should be built as non-exported symbols.
   */

*** win/makefile.vc2000/07/19 18:27:451.53
--- win/makefile.vc2000/07/31 23:57:35
***************
*** 313,319 ****
  <<

  $(TCLSTUBLIB): $(TCLSTUBOBJS)
! $(lib32) /out:$@ $(TCLSTUBOBJS)

  $(TCLPLUGINLIB): $(TCLPLUGINDLL)

--- 312,318 ----
  <<

  $(TCLSTUBLIB): $(TCLSTUBOBJS)
! $(lib32) -nologo -out:$@ $(TCLSTUBOBJS)

  $(TCLPLUGINLIB): $(TCLPLUGINDLL)

***************
*** 473,479 ****
  # be built as DLL objects but none of the symbols should be exported

  $(TMPDIR)\tclStubLib.obj : $(GENERICDIR)\tclStubLib.c
! $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -Fo$@ $?

  # Dedependency rules
--- 472,478 ----
  # be built as DLL objects but none of the symbols should be exported

  $(TMPDIR)\tclStubLib.obj : $(GENERICDIR)\tclStubLib.c
! $(cc32) -c -nologo -ML -DSTATIC_BUILD -Fo$@ $?

  # Dedependency rules

-- 07/31/2000 davidg
dgp Ticket [219383ffff]: 1 change [History diff]2001-04-05 06:52:44
davygrvyplain2001-04-21 05:41:49
Logged In: YES 
user_id=7549

somebody please delete this, thanks :)
hobbsplain2001-04-24 05:25:09
Logged In: YES 
user_id=72656

See bug 230582 instead.
https://sourceforge.net/tracker/index.php?
func=detail&aid=230582&group_id=10894&atid=110894
Log in (anonymous is fine) to add a comment.