summaryrefslogtreecommitdiffstats
path: root/generic/tcl.h
diff options
context:
space:
mode:
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