bug-gnulib
[Top][All Lists]
Advanced

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

unistd & sys/socket


From: Sam Steingold
Subject: unistd & sys/socket
Date: Thu, 14 Jul 2011 09:37:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi,
in what order do I include sys/socket and unistd?
sys_socket.in.h:
#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#  undef close
#  define close close_used_without_including_unistd_h
# else
   _GL_WARN_ON_USE (close,
                    "close() used without including <unistd.h>");
# endif
#endif

so, on windows, I must include unistd before sys/socket, otherwise close
will not work.

otoh:
unistd.in.h:
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname().  */
# if @UNISTD_H_HAVE_WINSOCK2_H@
#  if !defined _GL_SYS_SOCKET_H
#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#    undef socket
#    define socket              socket_used_without_including_sys_socket_h

so I must include sys/socket before unistd, otherwise socket (and many
others) will not work.

so, what is the right order?

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 
11.0.60900031
http://camera.org http://openvotingconsortium.org http://mideasttruth.com
http://iris.org.il http://pmw.org.il http://www.memritv.org
Lisp: it's here to save your butt.



reply via email to

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