Mercurial > gnulib
changeset 39234:c153a5913479
environ: Fix link error on 64-bit Cygwin.
* lib/unistd.in.h (environ): On Cygwin, redeclare with the
__declspec(dllimport) attribute.
* doc/posix-functions/environ.texi: Mention the Cygwin problem.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 31 Jan 2018 09:04:52 +0100 |
parents | 492d30539cc8 |
children | 6a04b04905e5 |
files | ChangeLog doc/posix-functions/environ.texi lib/unistd.in.h |
diffstat | 3 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jan 30 09:05:57 2018 +0100 +++ b/ChangeLog Wed Jan 31 09:04:52 2018 +0100 @@ -1,3 +1,10 @@ +2018-01-31 Bruno Haible <bruno@clisp.org> + + environ: Fix link error on 64-bit Cygwin. + * lib/unistd.in.h (environ): On Cygwin, redeclare with the + __declspec(dllimport) attribute. + * doc/posix-functions/environ.texi: Mention the Cygwin problem. + 2018-01-30 Bruno Haible <bruno@clisp.org> get-rusage-data: Add support for Minix 3.
--- a/doc/posix-functions/environ.texi Tue Jan 30 09:05:57 2018 +0100 +++ b/doc/posix-functions/environ.texi Wed Jan 31 09:04:52 2018 +0100 @@ -24,6 +24,9 @@ #define environ (*_NSGetEnviron()) @end smallexample This works at all versions of Mac OS X. +@item +On Cygwin in 64-bit mode, references to this variable cause a link error when +the option @code{-Wl,--disable-auto-import} is in use. @end itemize Portability problems not fixed by Gnulib:
--- a/lib/unistd.in.h Tue Jan 30 09:05:57 2018 +0100 +++ b/lib/unistd.in.h Wed Jan 31 09:04:52 2018 +0100 @@ -400,6 +400,13 @@ #if @GNULIB_ENVIRON@ +# if defined __CYGWIN__ +/* The 'environ' variable is defined in a DLL. Therefore its declaration needs + the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it. + This leads to a link error on 64-bit Cygwin when the option + -Wl,--disable-auto-import is in use. */ +_GL_EXTERN_C __declspec(dllimport) char **environ; +# endif # if !@HAVE_DECL_ENVIRON@ /* Set of environment variables and values. An array of strings of the form "VARIABLE=VALUE", terminated with a NULL. */