Boost C++ LibrariesSourceForge.net Logo

PrevUpHomeNext

Installation

The library has the compiled part which should be built as described in the Getting Started article. One thing should be noted, though. If your application consists of more than one module (e.g. an exe and one or several dll's) that use Boost.Log the library must be built as a shared object. If you have a single executable, you may build the library as a static library.

The library supports a number of configuration macros:

Table 1.1. Configuration macros

Macro name

Effect

BOOST_LOG_DYN_LINK

If defined in user code, the library will assume the binary is built as a dynamically loaded library ("dll" or "so"). Otherwise it is assumed that the library is built in static mode. This macro must be either defined or not defined for all translation units of user application that uses logging. This macro can help with auto-linking on platforms that support it.

BOOST_ALL_DYN_LINK

Same as BOOST_LOG_DYN_LINK but also affects other Boost libraries the same way.

BOOST_LOG_NO_THREADS

If defined, disables multithreading support. Has effect on both the library compilation and user's code compilation. The macro is automatically defined if no threading support detected.

BOOST_LOG_USE_CHAR

If defined, enables support for narrow character logging. Has effect on both the library compilation and user's code compilation.

BOOST_LOG_USE_WCHAR_T

If defined, enables support for wide character logging. Has effect on both the library compilation and user's code compilation. If neither BOOST_LOG_USE_CHAR nor BOOST_LOG_USE_WCHAR_T is defined, it is assumed the both character types support is enabled. Defining only one of them allows to significantly reduce binary size of the library.

BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER

Has effect on Windows platform only, on both the library compilation and user's code compilation stages. If defined, disables support for QueryPerformanceCounter API in the timer attribute. This will result in a significantly less accurate time readings. The macro is intended to solve possible problems with earlier revisions of AMD Athlon CPU, described here and here. There are also known chipset hardware failures that may prevent this API from functioning properly (see here).

BOOST_LOG_USE_NATIVE_SYSLOG

Has effect on the library compilation stage. If for some reason the support for native SysLog API is not detected, define this macro to forcibly enable support for native SysLog.

BOOST_LOG_NO_SETTINGS_PARSERS_SUPPORT

Has effect on the library compilation stage. If defined, all facilities related to settings parsing are not built. This can substantially reduce the binary size.

BOOST_LOG_NO_SHORTHAND_NAMES

Has effect on user's code compilation stage. If defined, some deprecated shorthand macro names will not be available.

BOOST_LOG_USE_WINNT6_API

Has effect both on the library and the user's code compilation stages. This macro is Windows-specific. If defined, the library makes use of the Windows NT 6 (Vista, Server 2008) and later APIs to generate more efficient code. This macro will also enable some experimental features of the library. Note, however, that the resulting binary will not run on Windows prior to NT 6. In order to use this feature Platform SDK 6.0 is required.


You may define configuration macros in the bjam command line, like this:

bjam --with-log variant=release define=BOOST_LOG_USE_CHAR define=BOOST_LOG_USE_WINNT6_API stage

However, it may be more convenient to define configuration macros in the "boost/config/user.hpp" file in order to automatically define them both for the library and user's projects.

The logging library also uses several Boost libraries that need building too. These are Boost.Filesystem, Boost.System, Boost.DateTime, Boost.Thread and Boost.Regex. Refer to their documentation for detailed instructions on building procedure.

One final thing should be added. The library requires run-time type information (RTTI) to be enabled for both the library compilation and user's code compilation. Normally, this won't need anything from you except to check that RTTI support is not disabled in your project.


PrevUpHomeNext