Boost logo

Boost :

From: Harold Howe [TeamB] (hhowe_at_[hidden])
Date: 2002-03-03 11:09:30


> Modified regex\config.hpp so that BOOST_REGEX_USE_VCL will be defined for
> console mode VCL programs.
>
> /***** New code *****/
> // This line originally was
> // written as this: # if !defined(__CONSOLE__) && !defined(_NO_VCL)
> // I have removed the __CONSOLE__ part.
> //
> # if !defined(_NO_VCL)
> # define BOOST_REGEX_USE_VCL
> # endif
>
>
> There is a potential problem here: the free bcb compiler (and the command
> line tools in general) do not define _NO_VCL - in fact there is no way to
> tell (as far as I can see) whether we have -tWV set on the command line or
> not, unless we rely on the IDE generated _NO_VCL flag.

Sorry, I wasn't thinking of the command line compiler. Yes, I can see how my change
would break it.

You could use Borland's #pragma defineonoption. It would allow you to #define _NO_VCL
if the -tWV switch was not set. Something like this:

// If _NO_VCL is not already defined by some IDE macro
// define it if -tWV is detected
#if !defined(_NO_VCL)
#pragma defineonoption -tWV
#endif

// Now use _NO_VCL to set the value of BOOST_REGEX_USE_VCL
# if !defined(_NO_VCL)
# define BOOST_REGEX_USE_VCL
# endif

Unfortunately, I don't think this is reliable. The -tWV switch doesn't really affect
the behavior of the compiler. It is really more of a linker directive. If you link
with bcc32, then -tWV tells the compiler to use the vcl set of libraries and startup
code. If you are not performing a link step, then -tWV isn't needed, and it often
isn't passed. I created a console mode VCL project in the BCB6 IDE, and -tWV was not
listed as a compiler flag. I don't think you can rely on people passing this flag,
especially if their makefiles link with ilink instead of bcc32.

Maybe you should just stick with the original code. BOOST_REGEX_USE_VCL is only used
by regex_library_include.hpp. If a developer wants to use regex in a VCL console mode
app, they are not completely sunk with the original code. They can always define
BOOST_REGEX_NO_LIB and manually link with the correct boost library. Or they could
just define BOOST_REGEX_USE_VCL if they are using the VCL. Either way, they still
have an option.

I would just go back to the original code. You might want to alter the comment to
explain the overall strategy. I will change the article and zip file on my website.

Harold Howe
hhowe_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk