From 9796bd47ad560b4867afc80bcb7f4cde910b59de Mon Sep 17 00:00:00 2001
From: John Maddock
my_library.cpp
++#ifndef MY_INCLUDE_GUARD #define MY_INCLUDE_GUARD // all includes go here: -#include <boost/config.hpp> +#include <boost/config.hpp> #include <whatever> -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif +#include <boost/config/abi_prefix.hpp> // must be the last #include namespace boost{ // your code goes here } -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas #endif // include guard+
my_library.cpp
++... +// nothing special need be done in the implementation file +...+
The user can disable this mechanism by defining BOOST_DISABLE_ABI_HEADERS, or they can define BOOST_ABI_PREFIX and/or BOOST_ABI_SUFFIX to point to their own prefix/suffix headers if they so wish.
@@ -1280,7 +1284,6 @@ namespace boost{ search path, and the compiler and linker do the rest. Boost.config supports this via the header <boost/config/auto_link.hpp>, before including this header one or more of the following macros need to be defined: -
BOOST_LIB_NAME | @@ -1298,25 +1301,39 @@ namespace boost{ (useful for debugging).
If the compiler supports this mechanism, then it will be told to link against the appropriately named library, the actual algorithm used to mangle the name of the library is documented inside <boost/config/auto_link.hpp> and has to match that used to create the libraries via bjam 's install rules.
-Typical usage would be:
-// -// Don't include auto-linking code if the user has disabled it by -// defining BOOST_WHATEVER_NO_LIB, or if this is one of our own -// source files (signified by BOOST_WHATEVER_SOURCE): +Typical usage is:
+my_library.hpp
+++... // -#if !defined(BOOST_WHATEVER_NO_LIB) && !defined(BOOST_WHATEVER_SOURCE) -# define BOOST_LIB_NAME boost_whatever -# ifdef BOOST_WHATEVER_DYN_LINK +// Don't include auto-linking code if the user has disabled it by +// defining BOOST_ALL_NO_LIB, or BOOST_MY_LIBRARY_NO_LIB, or if this +// is one of our own source files (signified by BOOST_MY_LIBRARY_SOURCE): +// +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_MY_LIBRARY_NO_LIB) && !defined(BOOST_MY_LIBRARY_SOURCE) +# define BOOST_LIB_NAME boost_my_library +# ifdef BOOST_MY_LIBRARY_DYN_LINK # define BOOST_DYN_LINK # endif # include <boost/config/auto_link.hpp> #endif +...+my_library.cpp
++// define BOOST_MY_LIBRARY_SOURCE so that the header knows that the +// library is being built (possibly exporting rather than importing code) +// +#define BOOST_MY_LIBRARY_SOURCE + +#include <boost/my_library/my_library.hpp> +...+Guidelines for Boost Authors
The boost/config.hpp header is used to pass configuration information to other boost files, allowing them to cope with