libtool-patches
[Top][All Lists]
Advanced

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

MSVC: stresstest.at fixes


From: Peter Rosin
Subject: MSVC: stresstest.at fixes
Date: Sun, 18 Jul 2010 18:45:53 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1

Hi!

Next in the MSVC queue. It's getting short quickly!

These two patches are commits
ee8c181987478752a9432a903cf7febbf761d034
dllimport when the lib is shared and not linking with -static

and

5ff2e6e4e5a1f05df59ccf11ba881de9df895cb5
dllimport variables for MSVC in stresstest.at

Previous review:
http://lists.gnu.org/archive/html/libtool-patches/2008-08/msg00056.html

The first patch is a remedy for the need to differentiate between
linking with a static library (no dllimport) and a shared one (dllimport
needed), i.e. the problem with various solutions listed by Chuck in
http://lists.gnu.org/archive/html/libtool-patches/2010-07/msg00060.html

I'm not sure how the first patch behaves when libtool is configured
with --disable-shared, but I'd like to come back and do any fixup
(if needed) once autotools handles absolute file names with MSVC
better. I.e. after Chuck has gotten his path conversion code in
http://lists.gnu.org/archive/html/libtool-patches/2009-06/msg00030.html
accepted and I have augmented it with a couple of extra bits, or fixed
the issue of MSVC (and GNU tools for that matter) not understanding
MSYS paths fed in command files some other way.

The second patch is very similar to how things are done in export.at,
see commit b28132eabade54dbb9ff18a5761be445d916e148 and the recent
thread at
http://lists.gnu.org/archive/html/libtool-patches/2010-07/msg00026.html

Cheers,
Peter


First patch:

2010-07-18  Peter Rosin  <address@hidden>

        * tests/stresstest.at: Link with main.lo when liba is shared
        and linking main with -no-install.

diff --git a/tests/stresstest.at b/tests/stresstest.at
index ee5fd29..c9fee10 100644
--- a/tests/stresstest.at
+++ b/tests/stresstest.at
@@ -252,9 +252,12 @@ do
                 [0],[ignore],[ignore])
        for st in '' '-static' '-no-install'
        do
-          case $st,$l3 in
-          ,-rpath*) mst= ;;
-          *) mst=-static ;;
+         # if -static is not passed, and the library is shared, then we have
+         # to use -DLIBA_DLL_IMPORT, thus main.lo (and not main-static.lo).
+         case $st,$l3 in
+         -static,*) mst=-static ;;
+         *,-rpath*) mst= ;;
+         *) mst=-static ;;
          esac

          LT_AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o "$rel"main$EXEEXT 
"$rel"main$mst.lo "$rel"sub2/liba.la],



Second patch:

2010-07-18  Peter Rosin  <address@hidden>

        * tests/stresstest.at [MSVC]: dllimport all imported
        variables.

diff --git a/tests/stresstest.at b/tests/stresstest.at
index ee5fd29..6522329 100644
--- a/tests/stresstest.at
+++ b/tests/stresstest.at
@@ -93,29 +93,35 @@ AT_DATA(main.c,
 #if defined(LIBA_DLL_IMPORT)
 #  if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__)
 #    define LIBA_SCOPE extern __declspec(dllimport)
+#    if defined(_MSC_VER)
+#      define LIBA_SCOPE_VAR LIBA_SCOPE
+#    endif
 #  endif
 #endif
 #if !defined(LIBA_SCOPE)
 #  define LIBA_SCOPE extern
 #endif
+#if !defined(LIBA_SCOPE_VAR)
+#  define LIBA_SCOPE_VAR extern
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern int v1;
-extern int v3, v4;
+LIBA_SCOPE_VAR int v1;
+LIBA_SCOPE_VAR int v3, v4;
 LIBA_SCOPE const int v5, v6;
-extern const char* v7;
-extern const char v8[];
+LIBA_SCOPE_VAR const char* v7;
+LIBA_SCOPE_VAR const char v8[];
 extern int v9(void);
-extern int (*v10) (void);
-extern int (*v11) (void);
+LIBA_SCOPE_VAR int (*v10) (void);
+LIBA_SCOPE_VAR int (*v11) (void);
 LIBA_SCOPE int (*const v12) (void);
 #ifdef __cplusplus
 }
 #endif

 typedef struct { int arr[1000]; } large;
-extern large v13, v14, v15;
+LIBA_SCOPE_VAR large v13, v14, v15;

 int main(void)
 {
@@ -131,26 +137,32 @@ AT_DATA(dlself.c,
 #if defined(LIBA_DLL_IMPORT)
 #  if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__)
 #    define LIBA_SCOPE extern __declspec(dllimport)
+#    if defined(_MSC_VER)
+#      define LIBA_SCOPE_VAR LIBA_SCOPE
+#    endif
 #  endif
 #endif
 #if !defined(LIBA_SCOPE)
 #  define LIBA_SCOPE extern
 #endif
+#if !defined(LIBA_SCOPE_VAR)
+#  define LIBA_SCOPE_VAR extern
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif
-extern int v1;
-extern int v3, v4;
+LIBA_SCOPE_VAR int v1;
+LIBA_SCOPE_VAR int v3, v4;
 LIBA_SCOPE const int v5, v6;
-extern const char* v7;
-extern const char v8[];
+LIBA_SCOPE_VAR const char* v7;
+LIBA_SCOPE_VAR const char v8[];
 extern int v9(void);
-extern int (*v10) (void);
-extern int (*v11) (void);
+LIBA_SCOPE_VAR int (*v10) (void);
+LIBA_SCOPE_VAR int (*v11) (void);
 LIBA_SCOPE int (*const v12) (void);

 typedef struct { int arr[1000]; } large;
-extern large v13, v14, v15;
+LIBA_SCOPE_VAR large v13, v14, v15;

 extern int w1;
 extern int w3, w4;



reply via email to

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