libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch #6448] [MSVC 7/7] Add MSVC Support


From: Peter Rosin
Subject: Re: [patch #6448] [MSVC 7/7] Add MSVC Support
Date: Wed, 13 Aug 2008 22:12:23 +0200
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

Peter Rosin skrev:
Peter Rosin skrev:
Attached, I'll work through all the failures to try to find out why
they fail...

*snip*

  24: link-order.at:26   Link order test.
Exporting int c variable.

With MSVC, you can declare any variable with __decspec(dllimport), even
if you are not actually importing it. The only thing that happens is
that you get an extra indirection in the generated code. This is a
small price to pay, when the gain is that you don't need to compile
things differently depending on how you are going to link with the
library. The situation is quite similar to pic/non-pic, but the trouble
is that the difference is in the library consumer and not when
producing the library.

So, ignoring the runtime performance penalty, patch things up like
this:

2008-08-13  Peter Rosin  <address@hidden>

        * tests/link-order.at [MSVC]: Always dllimport exported
        variables.
diff --git a/tests/link-order.at b/tests/link-order.at
index ce52cc9..8791df8 100644
--- a/tests/link-order.at
+++ b/tests/link-order.at
@@ -48,13 +48,29 @@ for i in old new; do
   mkdir src
 
   cat >src/a_$i.c <<EOF
-extern int c;
+/* w32 fun, MSVC supports dllimport even if importing is not needed (static
+ * case). gnu has auto import.
+ */
+#ifdef _MSC_VER
+#  define LIBCEE_SCOPE __declspec(dllimport)
+#else
+#  define LIBCEE_SCOPE extern
+#endif
+LIBCEE_SCOPE int c;
 extern int b_$i();
 int a_$i() { return c + b_$i(); }
 EOF
 
   cat >src/b_$i.c <<EOF
-extern int c;
+/* w32 fun, MSVC supports dllimport even if importing is not needed (static
+ * case). gnu has auto import.
+ */
+#ifdef _MSC_VER
+#  define LIBCEE_SCOPE __declspec(dllimport)
+#else
+#  define LIBCEE_SCOPE extern
+#endif
+LIBCEE_SCOPE int c;
 int b_$i() { return 1 + c; }
 EOF
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]