summaryrefslogtreecommitdiffstats
path: root/generic/tcl.h
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2005-10-14 11:14:31 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2005-10-14 11:14:31 (GMT)
commit25dac25a7acae9b4d403cd3a02160e7470be5c18 (patch)
tree00b6ea924753f686a36c10ce34028e4b294df520 /generic/tcl.h
parent4c4dbba0fe0d26097c20ac8bc74b873c7adbb28c (diff)
downloadtcl-25dac25a7acae9b4d403cd3a02160e7470be5c18.zip
tcl-25dac25a7acae9b4d403cd3a02160e7470be5c18.tar.gz
tcl-25dac25a7acae9b4d403cd3a02160e7470be5c18.tar.bz2
* generic/tcl.h: Fix for bug #1256937 - correctly decorate
* generic/tclMain.c: imported functions from msvcrt in static builds.
Diffstat (limited to 'generic/tcl.h')
-rw-r--r--generic/tcl.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index 0d43309..5e91a5a 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.204 2005/10/08 14:42:44 dgp Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.205 2005/10/14 11:14:31 patthoyts Exp $
*/
#ifndef _TCL
@@ -175,18 +175,34 @@ extern "C" {
* windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be
* nonempty. To build a static library, the macro STATIC_BUILD should be
* defined.
+ *
+ * Note: when building static but linking dynamically to MSVCRT we must still
+ * correctly decorate the C library imported function. Use CRTIMPORT
+ * for this purpose. _DLL is defined by the compiler when linking to
+ * MSVCRT.
*/
+#if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
+# define HAVE_DECLSPEC 1
+#endif
+
#ifdef STATIC_BUILD
# define DLLIMPORT
# define DLLEXPORT
+# if HAVE_DECLSPEC && defined(_DLL)
+# define CRTIMPORT __declspec(dllimport)
+# else
+# define CRTIMPORT
+# endif
#else
-# if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
+# if HAVE_DECLSPEC
# define DLLIMPORT __declspec(dllimport)
# define DLLEXPORT __declspec(dllexport)
+# define CRTIMPORT __declspec(dllimport)
# else
# define DLLIMPORT
# define DLLEXPORT
+# define CRTEXPORT
# endif
#endif