bug-gnulib
[Top][All Lists]
Advanced

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

putenv on MSVC


From: Bruno Haible
Subject: putenv on MSVC
Date: Sat, 17 Sep 2011 17:34:33 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

The declaration of 'environ' in putenv.c:40 leads to a warning about
"inconsistent DLL binding" and then later to a link error in test-unsetenv.

This fixes it.


2011-09-17  Bruno Haible  <address@hidden>

        putenv: Support for MSVC.
        * modules/putenv (Depends-on): Add environ.
        * lib/putenv.c (environ): Disable declaration.
        * lib/unistd.in.h: Update comment.

--- lib/putenv.c.orig   Sat Sep 17 17:27:21 2011
+++ lib/putenv.c        Sat Sep 17 17:25:41 2011
@@ -34,10 +34,12 @@
 #include <string.h>
 #include <unistd.h>
 
-#if HAVE_GNU_LD
+#if _LIBC
+# if HAVE_GNU_LD
 # define environ __environ
-#else
+# else
 extern char **environ;
+# endif
 #endif
 
 #if _LIBC
--- lib/unistd.in.h.orig        Sat Sep 17 17:27:21 2011
+++ lib/unistd.in.h     Sat Sep 17 17:24:17 2011
@@ -75,7 +75,8 @@
 #endif
 
 /* mingw fails to declare _exit in <unistd.h>.  */
-/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
+   <unistd.h>.  */
 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
 #ifndef __GLIBC__
--- modules/putenv.orig Sat Sep 17 17:27:21 2011
+++ modules/putenv      Sat Sep 17 17:24:44 2011
@@ -7,6 +7,7 @@
 
 Depends-on:
 stdlib
+environ         [test $REPLACE_PUTENV = 1]
 malloc-posix    [test $REPLACE_PUTENV = 1]
 
 configure.ac:

-- 
In memoriam Estella Agsteribbe <http://en.wikipedia.org/wiki/Estella_Agsteribbe>



reply via email to

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