From: Bruno Haible Date: Wed, 6 Sep 2023 19:13:25 +0000 (+0200) Subject: Don't export symbols from static object files on Windows. X-Git-Tag: v0.23~412 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e914861708ed459a2ae8157eb60d89375ab46cd;p=thirdparty%2Fgettext.git Don't export symbols from static object files on Windows. * gettext-tools/configure.ac (DLL_VARIABLE): Test DLL_EXPORT, not WOE32DLL. (WOE32DLL): Don't define as a C macro. * gettext-runtime/configure.ac: Likewise. (DLL_VARIABLE): Drop special assumption regarding 'exit_failure'. --- diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac index e88a231f2..35b020fec 100644 --- a/gettext-runtime/configure.ac +++ b/gettext-runtime/configure.ac @@ -132,17 +132,16 @@ else is_woe32dll=no fi AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes]) -if test $is_woe32dll = yes; then - AC_DEFINE([WOE32DLL], [1], - [Define when --enable-shared is used on Windows.]) -fi dnl Put some default definitions into config.h. AH_BOTTOM([ /* On Windows, variables that may be in a DLL must be marked specially. - But here, the only such variable is 'exit_failure', and it is always - built into a static library, never into a shared library. */ -#if defined WOE32DLL && !defined IN_RELOCWRAPPER && 0 + The symbols marked with DLL_VARIABLE should be exported if and only if the + object file gets included in a DLL. Libtool, on Windows platforms, defines + the C macro DLL_EXPORT (together with PIC) when compiling for a DLL + and does not define it when compiling an object file meant to be linked + statically into some executable. */ +#if (defined _WIN32 || defined __CYGWIN__) && defined DLL_EXPORT && !defined IN_RELOCWRAPPER # define DLL_VARIABLE __declspec (dllimport) #else # define DLL_VARIABLE diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index e4c9783eb..9a543d4e6 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -280,10 +280,6 @@ else is_woe32dll=no fi AM_CONDITIONAL([WOE32DLL], [test $is_woe32dll = yes]) -if test $is_woe32dll = yes; then - AC_DEFINE([WOE32DLL], [1], - [Define when --enable-shared is used on Windows.]) -fi GETTEXTLIB_EXPORTS_FLAGS= dnl woe32dll/gettextlib-exports.c needs to know whether the getopt facility @@ -339,8 +335,13 @@ AH_BOTTOM([ wrap the file position (#:) comments. */ #define PAGE_WIDTH 79 -/* On Windows, variables that may be in a DLL must be marked specially. */ -#if defined WOE32DLL && !defined IN_RELOCWRAPPER +/* On Windows, variables that may be in a DLL must be marked specially. + The symbols marked with DLL_VARIABLE should be exported if and only if the + object file gets included in a DLL. Libtool, on Windows platforms, defines + the C macro DLL_EXPORT (together with PIC) when compiling for a DLL + and does not define it when compiling an object file meant to be linked + statically into some executable. */ +#if (defined _WIN32 || defined __CYGWIN__) && defined DLL_EXPORT && !defined IN_RELOCWRAPPER # define DLL_VARIABLE __declspec (dllimport) #else # define DLL_VARIABLE