X-Spam-Check-By: sourceware.org Subject: portability notes From: skaller To: cygwin AT cygwin DOT com Content-Type: text/plain Date: Tue, 14 Feb 2006 18:31:18 +1100 Message-Id: <1139902278.8591.581.camel@rosella.wigram> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com We have done some things in a possibly non-optimal way, someone may wish to comment on a better way to do these things? CVS log entry for our systems says: * added WSAID_CONNECTEX and LPFN_CONNECTEX definitions for ming (nocygwin) target * now conditionally define EAGAIN in posix compat layer because ming seems to have it. The first comment is about Cygwin supplied MinGW support for Win32 functions. We use these calls, but they're not defined, so we hacked up our own declarations. The second issue is that I provided a POSIX portability API for pure MSVC++ Win32 environment, mainly support for synchronisation primitives including condition variables etc. For POSIX compatibility I had to define EAGAIN, which doesn't seem to be supplied in Windows headers. Unfortunately, MingW headers under Cygwin do seem to define it, hence the hack. Any suggestions how to do this better? The API we're providing provides threads, events, and other such stuff on multiple platforms including Linux, Solaris, Win32 native, Cygwin, Cygwin with -mno-cygwin, MSYS/MinGW (maybe), OSX, BSD, etc. There is a configure script .. not being used in the current hacks. The EAGAIN hack is this: // THIS IS SICK but there ain't no other way in C #define ETIMEDOUT WAIT_TIMEOUT // looks like EAGAIN is available in minggw, but not in vs sdk. #ifndef EAGAIN #define EAGAIN WAIT_TIMEOUT #endif and the WSAID_CONNECTEX hack is this: // cygwin's copy of mswsock.h leaves something to be desired... #ifndef WSAID_CONNECTEX typedef BOOL (PASCAL FAR * LPFN_CONNECTEX) ( IN SOCKET s, ... #define WSAID_CONNECTEX \ {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0 ... -- John Skaller Felix, successor to C++: http://felix.sf.net -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/