[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with differing build environments
From: |
Warren Young |
Subject: |
Re: Help with differing build environments |
Date: |
Wed, 06 Oct 2004 13:08:42 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910 |
Geoffrey Huang wrote:
I don't really like the prospect of having #if statements throughout the
code,
So hide it behind a macro in a header file:
#if defined(HAVE_FOOBAR)
# define FOOBAR(p) FooBar(p)
#else
# define FOOBAR(p) MyFooBarVersion(p)
#endif
Not rocket science.
I don't want my toolkit's functions linked
in when unnecessary, and likewise, I don't want the system's functions
linked in when unnecessary.
That's the linker's problem.
And if the linker isn't going to cooperate, you can use autoconf to test
for the need of a library, and conditionally link to it. There's a
pthreads macro out there on one of the major autoconf archives that
shows this technique, since various systems put the thread calls in
different libraries.