cURL / Mailing Lists / curl-library / Single Mail

curl-library

Removing WIN32 dependencies

From: Yang Tse <yangsita_at_gmail.com>
Date: Wed, 19 Jul 2006 16:58:51 +0200

Hi,

Compilation of curl is heavily dependant on the fact of having symbol
WIN32 defined or not. At this moment this is at least partially broken
for cross-compiling Windows native targets and also for non-native
Windows targets when compiling with WIN32 defined, i.e. cygwin under
posix emulation mode.

In other words this has to be fixed somehow to properly build
cross-compiled Windows targets and cygwin targets.

curl's code is plagued with statements like:

#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#if defined(WIN32) && !defined(__CYGWIN__)
#if defined(WIN32) && !defined(WATT32)
#ifndef WIN32
#ifdef WIN32

And all of them should be revisited, and most of them modified to fix
the before mentioned problem.

This could be done using compiler specific defined symbols, but I
think it is better to try to get rid of most of the compiler dependant
symbols in source code. This could be done introducing a new symbol
which could be "TARGET_WIN_NATIVE", "WIN_NATIVE" or something similar
which would be defined in config.h or specific config file when
building a Windows native target, making source code depend on this
new symbol being defined or not instead of depending on WIN32.

Somehow related with this is compilation for Windows CE. Windows CE
should not be treated as a Windows native target, at most it is a
subset of WIN32 and a subset of WinSock with lots of limitations and
only a partially implemented standard C library. In plain words, WinCE
is a different OS than Windows, and as such definition of symbols
_WIN32_WCE and TARGET_WIN_NATIVE should be mutually exclusive.

Probably it would be better yet to introduce another new symbol such
as "TARGET_WIN_CE" to take care of this.

Suggestions, comments, indications, anything ?

Regards,

-- 
-=[Yang]=-
Received on 2006-07-19