This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
sys/socket #define problems
- To: gnu-win32 at cygnus dot com
- Subject: sys/socket #define problems
- From: Graham dot Dumpleton at nms dot otc dot com dot au (Graham Dumpleton)
- Date: Sat, 30 Aug 1997 16:07:51 +1000 (EST)
In sys/socket.h, there exists a whole bunch of #define's like:
#define bind cygwin32_bind
...
The intent is to ensure that the Win32 versions of these functions are not
used. Can some other way be found of doing this, or for C++ at least, can
they be made into C++ inline functions.
The problem is that some of the names are common enough that one might use
them as member function names in C++ classes. To an extent this isn't a
problem, however, it is if the order of #include's is such that you include
sys/socket.h after the header file which used one of these names, eg. bind.
After the point where sys/socket.h is included, your use of the name gets
changed, with the cygwin32_ prefix being added. A number of things can
happen. If your version of the function had the same prototype, but, was a
member of a class, the compiler will quite silently compile the file as
okay, however, in reality, it has called the wrong function, not calling
your function in the class, but the system bind. A second possibility is
that your function had a different prototype in which case it will not find
the function and the compiler will given an error. A similar case would be
where the name was used as a member variable name, the compiler simply
wouldn't find it.
--
Graham Dumpleton (grahamd@nms.otc.com.au)
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".