We're using Boost's regex package in a Windows environment for a server built with Microsoft Visual Studio 7.x. We'd like to be able to build our server with debugging symbols for our own code, but still use the release versions of the Microsoft runtime DLLs (because the debugging versions of the Microsoft runtime DLLs aren't redistributable, so we can't legally install them on our production server). The problem is, when we compile our own code for debugging (with -Zi and -D_DEBUG), the Boost headers detect this and do their behind-the-curtain magic to point to a version of the regex package which is linked to the debugging versions of the runtime libraries (msvcr71d and msvcp71d). We've tried using the BOOST_REGEX_NO_LIB trick, specifying the version of the regex library to which we want to link (boost_regex_vc7_mdi.lib) but this doesn't work, because although it compiles fine, the linker chokes complaining about the inability to find a bunch of severely mangled names.
Hmm, the Microsoft's docs specify that _DEBUG is "Defined when compiling with /LDd, /MDd, /MLd, and /MTd.", that isn't the case here, so it shouldn't be defined. However I've just checked, and the IDE does seem to want to set it when building in "debug" mode irrespective of which runtime you're actually using. If you're building from a makefile though the best idea would be to not define this symbol. Alternatively build in release mode with but with debug symbols on. If you build with BOOST_REGEX_NO_LIB defined then you will get undefined externals unless you manually specify which library to link against. BTW, I've just checked with Microsoft's own headers, and they also use _DEBUG to determine which runtime to link against, in the same manner that regex does - see for example use_ansi.h or comdef.h. John.
What's the *real* trick for using the version of the library we want? Do we need to hack the distributed makefile each time we upgrade regex? (Or worse, shuffle libraries around by renaming them?)
Thanks.
Bob Kline
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users