[Define when --enable-shared is used on Windows.])
fi
-GETTEXTLIB_EXPORTS_FLAGS=
-dnl woe32dll/gettextlib-exports.c needs to know whether the getopt facility
-dnl is replaced by gnulib. GETOPT_H is set by gl_FUNC_GETOPT_POSIX, inside
-dnl gl_INIT.
-if test -n "$GETOPT_H"; then
- GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_GETOPT $GETTEXTLIB_EXPORTS_FLAGS"
-fi
-dnl woe32dll/gettextlib-exports.c needs to know whether the error
-dnl facility is replaced by gnulib. ac_cv_lib_error_at_line is set by
-dnl gl_ERROR, inside gl_INIT.
-if test "$ac_cv_lib_error_at_line" = no; then
- GETTEXTLIB_EXPORTS_FLAGS="-DGNULIB_DEFINED_ERROR $GETTEXTLIB_EXPORTS_FLAGS"
-fi
-AC_SUBST([GETTEXTLIB_EXPORTS_FLAGS])
-
dnl Tell the source files that the error facility is overridden by gnulib,
dnl to make sure to prepend "rpl_" prefix to the error_* symbols.
dnl This is only necessary on Cygwin and on Android.
# Needed for the expansion of LIBGETTEXTSRC_DLL_VARIABLE on MSVC.
libgettextsrc_la_CPPFLAGS += -DIN_LIBGETTEXTSRC
-# Tell the mingw or Cygwin linker which symbols to export.
-if WOE32DLL
-libgettextsrc_la_SOURCES += ../woe32dll/gettextsrc-exports.c
-libgettextsrc_la_LDFLAGS += -Wl,--export-all-symbols
-libgettextsrc_la_CPPFLAGS += $(GETTEXTLIB_EXPORTS_FLAGS)
-endif
-
# Specify installation directory, for --enable-relocatable.
if RELOCATABLE_VIA_LD
# This is needed, because libgettextsrc depends on libgettextlib and libintl.
/* Exporting symbols from Windows shared libraries.
- Copyright (C) 2006, 2011-2023 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2011-2025 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-/* There are four ways to build shared libraries on Windows:
+/* Two things are complicated when dealing with shared libraries on Windows:
+ - Exporting symbols from shared libraries (→ 'dllexport'),
+ - Referencing symbols in shared libraries from outside the library
+ (→ 'dllimport').
+ Without GNU libtool, the complications apply to both functions and variables.
+ With GNU libtool, the complications apply to variables only; GNU libtool
+ deals with the functions.
+
+ There are four ways to build shared libraries on Windows:
- Export only functions, no variables.
This has the drawback of severely affecting the programming style in use.
1. the header files are unique to this library (not shared with
other packages), and
2. the library sources are contained in one directory, making it easy
- to define a -DBUILDING_LIBXYZ flag for the library.
+ to define a -DBUILDING_LIBXYZ flag for the library (either in
+ AM_CPPFLAGS or in libxyz_la_CPPFLAGS).
Example:
- #ifdef BUILDING_LIBICONV
- #define LIBICONV_SHLIB_EXPORTED __declspec(dllexport)
- #else
- #define LIBICONV_SHLIB_EXPORTED __declspec(dllimport)
+ #if (defined _WIN32 || defined __CYGWIN__) && WOE32DLL
+ // on Windows, with --enable-shared
+ # if BUILDING_LIBXYZ // building code for libxyz
+ # if defined DLL_EXPORT // compiling object files for a DLL
+ # define LIBXYZ_SHLIB_EXPORTED __declspec(dllexport)
+ # else // compiling static object files
+ # define LIBXYZ_SHLIB_EXPORTED
+ # endif
+ # else // building code outside libxyz
+ # define LIBXYZ_SHLIB_EXPORTED __declspec(dllimport)
+ # endif
+ #else // not Windows, or --disable-shared
+ # define LIBXYZ_SHLIB_EXPORTED
#endif
- We use this technique for the libintl and the libiconv libraries.
+ We use this technique for
+ - libiconv,
+ - libintl,
+ - libgettextlib and libgettextsrc.
- Define a macro that expands to __declspec(dllimport) always, and use
it in all header files of the library. Use an explicit export list for
This is acceptable if
1. the programming language is not C++ (because the name mangling of
static struct/class fields and of variables in namespaces makes it
- hard to maintain an export list).
+ hard to maintain an export list),
+ 2. there are no constructs such as
+ extern __declspec (dllimport) int var;
+ int * const b = &var;
+ or equivalent (e.g. as in gnulib/lib/uninorm/nfc.c),
+ because these constructs give a compilation error.
The benefit of this approach is that the partitioning of the source files
into libraries (which source file goes into which library) does not
affect the source code; only the Makefiles reflect it.
The performance loss due to the unnecessary indirection for references
to variables from within the library defining the variable is acceptable.
- We use this technique for libgettextlib (because it contains many gnulib
- modules) and for libgettextsrc (because this makes it easy to move source
- code from an msg* program to libgettextsrc). The macro is called
- DLL_VARIABLE.
-
This file allows building an explicit export list. You can either
- specify the variables to be exported, and use the GNU ld option
--export-all-symbols to export all function names, or
+++ /dev/null
-/* List of exported symbols of libgettextlib on Cygwin and native Windows.
- Copyright (C) 2006-2025 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-#include "woe32dll/export.h"
-
-VARIABLE(argmatch_die)
-#if GNULIB_DEFINED_ERROR
-# if GNULIB_REPLACE_ERROR
-VARIABLE(rpl_error_message_count)
-VARIABLE(rpl_error_one_per_line)
-VARIABLE(rpl_error_print_progname)
-# else
-VARIABLE(error_message_count)
-VARIABLE(error_one_per_line)
-VARIABLE(error_print_progname)
-# endif
-#endif
-VARIABLE(error_with_progname)
-VARIABLE(exit_failure)
-VARIABLE(gl_carray_list_implementation)
-VARIABLE(gl_hash_map_implementation)
-VARIABLE(gl_hash_set_implementation)
-VARIABLE(gl_linked_list_implementation)
-VARIABLE(gl_linkedhash_list_implementation)
-VARIABLE(program_name)
-#if GNULIB_DEFINED_GETOPT
-VARIABLE(rpl_optarg)
-VARIABLE(rpl_optind)
-#endif
-VARIABLE(simple_backup_suffix)
+++ /dev/null
-/* List of exported symbols of libgettextsrc on Cygwin and native Windows.
- Copyright (C) 2006-2025 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2006.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "woe32dll/export.h"
-
-VARIABLE(allow_duplicates)
-VARIABLE(format_language)
-VARIABLE(format_language_pretty)
-VARIABLE(formatstring_awk)
-VARIABLE(formatstring_boost)
-VARIABLE(formatstring_c)
-VARIABLE(formatstring_cplusplus_brace)
-VARIABLE(formatstring_csharp)
-VARIABLE(formatstring_d)
-VARIABLE(formatstring_elisp)
-VARIABLE(formatstring_gcc_internal)
-VARIABLE(formatstring_gfc_internal)
-VARIABLE(formatstring_go)
-VARIABLE(formatstring_java)
-VARIABLE(formatstring_java_printf)
-VARIABLE(formatstring_javascript)
-VARIABLE(formatstring_kde)
-VARIABLE(formatstring_kde_kuit)
-VARIABLE(formatstring_librep)
-VARIABLE(formatstring_lisp)
-VARIABLE(formatstring_lua)
-VARIABLE(formatstring_modula2)
-VARIABLE(formatstring_objc)
-VARIABLE(formatstring_parsers)
-VARIABLE(formatstring_pascal)
-VARIABLE(formatstring_perl)
-VARIABLE(formatstring_perl_brace)
-VARIABLE(formatstring_php)
-VARIABLE(formatstring_python)
-VARIABLE(formatstring_python_brace)
-VARIABLE(formatstring_qt)
-VARIABLE(formatstring_qt_plural)
-VARIABLE(formatstring_ruby)
-VARIABLE(formatstring_rust)
-VARIABLE(formatstring_scheme)
-VARIABLE(formatstring_sh)
-VARIABLE(formatstring_smalltalk)
-VARIABLE(formatstring_tcl)
-VARIABLE(formatstring_ycp)
-VARIABLE(gram_max_allowed_errors)
-VARIABLE(input_format_po)
-VARIABLE(input_format_properties)
-VARIABLE(input_format_stringtable)
-VARIABLE(less_than)
-VARIABLE(more_than)
-VARIABLE(msgcomm_mode)
-VARIABLE(omit_header)
-VARIABLE(output_format_po)
-VARIABLE(output_format_properties)
-VARIABLE(output_format_stringtable)
-VARIABLE(plural_table)
-VARIABLE(plural_table_size)
-VARIABLE(po_charset_ascii)
-VARIABLE(po_charset_utf8)
-VARIABLE(po_error)
-VARIABLE(po_error_at_line)
-VARIABLE(po_multiline_error)
-VARIABLE(po_multiline_warning)
-VARIABLE(syntax_check_name)
-VARIABLE(textmode_xerror_handler_struct)
-VARIABLE(use_first)
lib_LDFLAGS += -release @VERSION@
-# Tell the mingw or Cygwin linker which symbols to export.
-if WOE32DLL
-lib_SOURCES += ../woe32dll/gettextlib-exports.c
-lib_LDFLAGS += -Wl,--export-all-symbols
-AM_CPPFLAGS += @GETTEXTLIB_EXPORTS_FLAGS@
-endif
-
Include:
License: