cURL / Mailing Lists / curl-library / Single Mail

curl-library

FW: ## macro question

From: <Priya.Ramakrishnan_at_WellsFargo.COM>
Date: Mon, 29 Jul 2002 10:14:34 -0700

-----Original Message-----
From: Jones, Ryan P.
Sent: Monday, July 29, 2002 10:13 AM
To: Ramakrishnan, Priya
Subject: FW: ## macro question

Hi Priya,
        Can you forward this to Daniel.

The reason we don't use __STDC__ is because we are compiling C++ code with a
C++ compiler. The compiler is smart enough to know what is C and what is
C++, but if we use __STDC__ in our makefiles, our C++ compiler complains
when compiling C++ code because extra libs are pulled in that often
overwrite certain system functions that we use.
Perhaps we need a more open #define clause were we can specify what platform
we are on and which macro def works for us.

We compile curl separately with a C compiler. But when we compile our C++
code we source in the curl headers and link to the curl libs. The sourcing
in of the headers is causing the problems. When our code includes curl.h our
build fails, because CINIT and CFINIT are not syntactically correct
(according to our compilers).

Is it possible to isolate the non-standard CINIT & CFINIT (the ones with
/**/) and make the ## macro def the default?

In the initial code snippet I set, I apologize for making the check
reversed. Thanks for your help.

Ryan P. Jones
MWS (BOS)
415-222-5046

> But the ifdef statement used to separate the different definitions of
CINIT
> and CFINIT break our builds. We were using 7.9.5 with the single
definition
> of CINIT and CFINIT. 7.9.5 worked great.

Worked great for most of us, since most of us use good and healthy ANSI/ISO
compilers. Then someone threw the header on a less friendly compiler and
then
we needed to add that preprocessor check.

Now we need to extend the check to make more compilers happy.

> #ifdef CINIT
> #undef CINIT
> #endif
> #if defined(__STDC__) || defined(_MSC_VER)
> #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type +
> number
> #else
>
> ^^^ This only works on WINDOWS because of _MSC_VER, but not on HP or SUN..

I fail to understand *why* the HP and SUN compilers don't have __STDC__
defined though. Do they have _XOPEN_SOURCE defined? Or do you have any other
interesting suggestions? ;-)

> What if we tried this? It is just a suggestion. We are using aCC A.03.34
> (HP) and gcc 3.0.4 (SUN) and cl.exe 12.00.8168 (windows/VC++ 6.0)
>
> #if defined(ISO_C)

Well, *no* compiler has that defined! Besides, you made the check reversed,
as ISO compilers are likely to (or rather should) have and support ##.

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
Received on 2002-07-29