| View previous topic :: View next topic |
| Author |
Message |
newsgroups.borland.com Guest
|
Posted: Thu May 17, 2007 10:43 pm Post subject: Builder Version Constant? |
|
|
How can a program know at compile time if it's being built under BCB5 or
BCB6? I maintain a C++ library which is used by other programmers at my
company. Most of our programs are written with BCB5, but BCB6 is trickling
in. I've just received a bug report that a library function's name clashes
with a name used by BCB6. Simply changing the name would break existing
BCB5 applications. Is there a Borland-defined constant (like WINVER) that
identifies the version of Builder? I'd like to do this:
#if (BUILDER_VERSION = 5)
int OldConflictingName(int* data)
#else
int NewNameForSameFunction(int* data)
#endif
Thanks in advance,
Robert L. Smith |
|
| Back to top |
|
 |
Andrew Bond Guest
|
Posted: Thu May 17, 2007 11:39 pm Post subject: Re: Builder Version Constant? |
|
|
Robert
| Quote: | How can a program know at compile time if it's being built under BCB5 or
BCB6?Robert L. Smith
|
#if (__BORLANDC__ >= 0x0700)
// Borland C++BuilderX 1 (bccx.exe)
#elif (__BORLANDC__ >= 0x0590)
// CodeGear C++Builder 2007 (bcc.exe)
#elif (__BORLANDC__ >= 0x0580)
// Borland C++Builder 2006 (bcc.exe)
#elif (__BORLANDC__ >= 0x0560)
// Borland C++Builder 6 (bcc.exe)
#elif (__BORLANDC__ >= 0x0550)
// Borland C++Builder 5 (bcc.exe)
#else
#error Borland compiler earlier than C++Builder 5
#endif
HTH
Andrew |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu May 17, 2007 11:55 pm Post subject: Re: Builder Version Constant? |
|
|
"newsgroups.borland.com" <x.x> wrote in message
news:464c9436 (AT) newsgroups (DOT) borland.com...
| Quote: | Is there a Borland-defined constant (like WINVER) that
identifies the version of Builder?
|
Yes - the __BORLANDC__ precompiler define.
| Quote: | I'd like to do this:
|
#if ((__BORLANDC__ >= 0x0550) && (__BORLANDC__ < 0x0560))
// is BCB 5 ...
#else
// not BCB 5 ...
#endif
The reason for the range checking is because service packs increment
the last hex digit, ie 0x551, 0x0552, etc.
This would be a better aproach:
#if (__BORLANDC__ < 0x0560)
// is before BCB 6 ...
#else
// is BCB 6 or higher ...
#endif
Gambit |
|
| Back to top |
|
 |
|