libtool-patches
[Top][All Lists]
Advanced

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

Re: libltdl exports no symbols (cygwin)


From: Ralf Wildenhues
Subject: Re: libltdl exports no symbols (cygwin)
Date: Sun, 28 Jan 2007 14:33:33 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Charles,

Apologies for the huge delay.

* Charles Wilson wrote on Tue, Oct 17, 2006 at 04:16:16PM CEST:
> 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.

I applied this patch now, with a tiny change: instead of
  #  /* some comment */

use
     /* some comment */

as I guess that's less likely to disturb a preprocessor.  Below is what
I applied.

I am a bit wary that it may cause regressions in users' packages, as
they may be using LT_SCOPE.  But I see that with the other change, this
is needed.

I assume the patch below which is a straightforward port to HEAD, is
needed there as well?  I've applied it but not tested it yet on w32.
(The readtext mode was already fixed in HEAD.)

I'm still wondering what to put in NEWS for this and the depending
change.  We should mention this somehow.  Suggestions appreciated.

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

A small nit: that's a mailing list address, right?  I don't think that's
appropriate here, please correct me if wrong.  For now I used the entry
as below.

>       * 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.

Cheers,
Ralf

HEAD:
2007-01-28  Charles Wilson  <address@hidden>

        * libltdl/libltdl/lt__private.h (LT_GLOBAL_DATA) [__CYGWIN__]:
        Also define on Cygwin.
        * libltdl/libltdl/lt_system.h (LT_SCOPE) [__CYGWIN__]: Likewise.

Index: libltdl/libltdl/lt__private.h
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/libltdl/lt__private.h,v
retrieving revision 1.11
diff -u -r1.11 lt__private.h
--- libltdl/libltdl/lt__private.h       27 Jan 2007 16:45:38 -0000      1.11
+++ libltdl/libltdl/lt__private.h       28 Jan 2007 13:20:00 -0000
@@ -59,10 +59,17 @@
 #  include <dmalloc.h>
 #endif
 
-#if defined(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__)
+#  if defined(DLL_EXPORT)      /* defined by libtool (if required) */
+#   define LT_GLOBAL_DATA      __declspec(dllexport)
+#  endif
+# endif
+# ifndef LT_GLOBAL_DATA
+#  define LT_GLOBAL_DATA       /* static linking or !__WINDOWS__ */
+# endif
 #endif
 
 #ifndef __attribute__
Index: libltdl/libltdl/lt_system.h
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/libltdl/lt_system.h,v
retrieving revision 1.3
diff -u -r1.3 lt_system.h
--- libltdl/libltdl/lt_system.h 4 Sep 2006 17:25:15 -0000       1.3
+++ libltdl/libltdl/lt_system.h 28 Jan 2007 13:20:00 -0000
@@ -97,11 +97,12 @@
 /* DLL building support on win32 hosts;  mostly to workaround their
    ridiculous implementation of data symbol exporting. */
 #if !defined(LT_SCOPE)
-#  if defined(__WINDOWS__)
+#  if defined(__WINDOWS__) || defined(__CYGWIN__)
 #    if defined(DLL_EXPORT)            /* defined by libtool (if required) */
 #      define LT_SCOPE extern __declspec(dllexport)
 #    endif
 #    if defined(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


branch-1-5:
2007-01-28  Charles Wilson  <address@hidden>

        * libltdl/ltdl.c (LT_GLOBAL_DATA) [__CYGWIN__]: Also define on
        Cygwin.
        (LT_READTEXT_MODE): Ensure proper textmode fopen is used on
        Cygwin.
        * libltdl/ltdl.h (LT_SCOPE) [__CYGWIN__]: Also define on Cygwin.

Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.24
diff -u -r1.174.2.24 ltdl.c
--- libltdl/ltdl.c      27 Jan 2007 16:22:16 -0000      1.174.2.24
+++ libltdl/ltdl.c      28 Jan 2007 13:24:59 -0000
@@ -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"
Index: libltdl/ltdl.h
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.h,v
retrieving revision 1.57.2.4
diff -u -r1.57.2.4 ltdl.h
--- libltdl/ltdl.h      22 Apr 2005 09:05:43 -0000      1.57.2.4
+++ libltdl/ltdl.h      28 Jan 2007 13:24:59 -0000
@@ -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]