libtool-patches
[Top][All Lists]
Advanced

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

libltdl exports no symbols (cygwin)


From: Charles Wilson
Subject: libltdl exports no symbols (cygwin)
Date: Tue, 17 Oct 2006 10:16:16 -0400
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

On cygwin, we relied on gcc's default export-all behavior when creating libltdl. However, if any symbols are explicitly marked declspec(dllexport), then the export-all behavior is switched off.

Becuase of this change:
http://lists.gnu.org/archive/html/libtool-patches/2006-06/msg00000.html

the following stanza in ltdl.c is now triggered:
  #ifdef DLL_EXPORT
  #  define LT_GLOBAL_DATA       __declspec(dllexport)
  #else
  #  define LT_GLOBAL_DATA
  #endif
which results in explicit declspecs of ONLY the following:
  lt_dlmalloc
  lt_dlrealloc
  lt_dlfree
and all other symbols are therefore no longer exported. Because the June patch was still the Right Thing To Do, the fix here is to use the same logic for defining LT_GLOBAL_DATA in ltdl.c as is used to define LT_SCOPE in ltdl.h. (While we are at it, we should also only export symbols in the public interface, so use explicit declspec(dllexport) markings even on cygwin).

This patch is against CVS on branch-1-5. I'll follow up with a similar patch for HEAD.

2006-10-17  Charles Wilson  <address@hidden>

        * ltdl.c: be smarter about defining LT_GLOBAL_DATA. Ensure
        proper textmode fopen is used on cygwin.
        * ltdl.h: use declspec(dllexport) on cygwin, too.

--
Chuck
diff -urN origsrc/libtool/libltdl/ltdl.c src/libtool/libltdl/ltdl.c
--- origsrc/libtool/libltdl/ltdl.c      2006-10-13 10:13:31.000000000 -0400
+++ src/libtool/libltdl/ltdl.c  2006-10-17 01:15:38.015625000 -0400
@@ -137,16 +137,22 @@
 
 /* --- WINDOWS SUPPORT --- */
 
-
-#ifdef DLL_EXPORT
-#  define LT_GLOBAL_DATA       __declspec(dllexport)
-#else
-#  define LT_GLOBAL_DATA
+/* DLL building support on win32 hosts;  mostly to workaround their
+   ridiculous implementation of data symbol exporting. */
+#ifndef LT_GLOBAL_DATA
+#  if defined(__WINDOWS__) || defined(__CYGWIN__)
+#    ifdef DLL_EXPORT           /* defined by libtool (if required) */
+#      define LT_GLOBAL_DATA __declspec(dllexport)
+#    endif
+#  endif
+#  ifndef LT_GLOBAL_DATA        /* static linking or !__WINDOWS__ */
+#    define LT_GLOBAL_DATA
+#  endif
 #endif
 
 /* fopen() mode flags for reading a text file */
 #undef LT_READTEXT_MODE
-#ifdef __WINDOWS__
+#if defined(__WINDOWS__) || defined(__CYGWIN__)
 #  define LT_READTEXT_MODE "rt"
 #else
 #  define LT_READTEXT_MODE "r"
diff -urN origsrc/libtool/libltdl/ltdl.h src/libtool/libltdl/ltdl.h
--- origsrc/libtool/libltdl/ltdl.h      2005-04-22 05:05:43.000000000 -0400
+++ src/libtool/libltdl/ltdl.h  2006-10-17 01:15:38.078125000 -0400
@@ -127,11 +127,12 @@
 /* DLL building support on win32 hosts;  mostly to workaround their
    ridiculous implementation of data symbol exporting. */
 #ifndef LT_SCOPE
-#  ifdef __WINDOWS__
+#  if defined(__WINDOWS__) || defined(__CYGWIN__)
 #    ifdef DLL_EXPORT          /* defined by libtool (if required) */
 #      define LT_SCOPE __declspec(dllexport)
 #    endif
 #    ifdef LIBLTDL_DLL_IMPORT  /* define if linking with this dll */
+#      /* note: cygwin/mingw compilers can rely instead on auto-import */
 #      define LT_SCOPE extern __declspec(dllimport)
 #    endif
 #  endif

reply via email to

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