mirror of
https://github.com/boostorg/config.git
synced 2025-07-31 21:04:28 +02:00
Applied Beman Dawes patches to tidy up examples.
[SVN r31009]
This commit is contained in:
59
config.htm
59
config.htm
@@ -1235,31 +1235,35 @@ void g() { return f(); }</pre>
|
|||||||
ABI, that at least in theory there 3200 combinations, and that's without
|
ABI, that at least in theory there 3200 combinations, and that's without
|
||||||
considering runtime library variations. Fortunately these variations can
|
considering runtime library variations. Fortunately these variations can
|
||||||
be managed by #pragma's that tell the compiler what ABI to use for the types
|
be managed by #pragma's that tell the compiler what ABI to use for the types
|
||||||
declared in your library, in order to avoid sprinkling #pragma's all over the
|
declared in your library. In order to avoid sprinkling #pragma's all over the
|
||||||
boost headers, there are some prefix and suffix headers that do the job,
|
boost headers, there are some prefix and suffix headers that do the job.
|
||||||
typical usage would be:</P>
|
Typical usage is:</P>
|
||||||
|
<P><b>my_library.cpp</b></P>
|
||||||
|
<blockquote>
|
||||||
<PRE>#ifndef MY_INCLUDE_GUARD
|
<PRE>#ifndef MY_INCLUDE_GUARD
|
||||||
#define MY_INCLUDE_GUARD
|
#define MY_INCLUDE_GUARD
|
||||||
|
|
||||||
// all includes go here:
|
// all includes go here:
|
||||||
#include <boost/config.hpp>
|
<b>#include <boost/config.hpp></b>
|
||||||
#include <whatever>
|
#include <whatever>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
<b>#include <boost/config/abi_prefix.hpp> // must be the last #include</b>
|
||||||
# include BOOST_ABI_PREFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost{
|
namespace boost{
|
||||||
// your code goes here
|
// your code goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
<b>#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas</b>
|
||||||
# include BOOST_ABI_SUFFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif // include guard
|
#endif // include guard
|
||||||
</PRE>
|
</PRE>
|
||||||
|
</blockquote>
|
||||||
|
<P><b>my_library.cpp</b></P>
|
||||||
|
<blockquote>
|
||||||
|
<pre>...
|
||||||
|
<b>// nothing special need be done in the implementation file</b>
|
||||||
|
...</pre>
|
||||||
|
</blockquote>
|
||||||
<P>The user can disable this mechanism by defining BOOST_DISABLE_ABI_HEADERS, or
|
<P>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
|
they can define BOOST_ABI_PREFIX and/or BOOST_ABI_SUFFIX to point to their own
|
||||||
prefix/suffix headers if they so wish.</P>
|
prefix/suffix headers if they so wish.</P>
|
||||||
@@ -1280,7 +1284,6 @@ namespace boost{
|
|||||||
search path, and the compiler and linker do the rest. Boost.config
|
search path, and the compiler and linker do the rest. Boost.config
|
||||||
supports this via the header <boost/config/auto_link.hpp>, before
|
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:</P>
|
including this header one or more of the following macros need to be defined:</P>
|
||||||
<P>
|
|
||||||
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="1">
|
||||||
<TR>
|
<TR>
|
||||||
<TD>BOOST_LIB_NAME</TD>
|
<TD>BOOST_LIB_NAME</TD>
|
||||||
@@ -1298,25 +1301,39 @@ namespace boost{
|
|||||||
(useful for debugging).</TD>
|
(useful for debugging).</TD>
|
||||||
</TR>
|
</TR>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
</P>
|
|
||||||
<P>If the compiler supports this mechanism, then it will be told to link against
|
<P>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
|
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
|
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.</P>
|
to match that used to create the libraries via bjam 's install rules.</P>
|
||||||
<P>Typical usage would be:</P>
|
<P>Typical usage is:</P>
|
||||||
<PRE>//
|
<P><b>my_library.hpp</b></P>
|
||||||
// Don't include auto-linking code if the user has disabled it by
|
<blockquote>
|
||||||
// defining BOOST_WHATEVER_NO_LIB, or if this is one of our own
|
<PRE>...
|
||||||
// source files (signified by BOOST_WHATEVER_SOURCE):
|
|
||||||
//
|
//
|
||||||
#if !defined(BOOST_WHATEVER_NO_LIB) && !defined(BOOST_WHATEVER_SOURCE)
|
// Don't include auto-linking code if the user has disabled it by
|
||||||
# define BOOST_LIB_NAME boost_whatever
|
// defining BOOST_ALL_NO_LIB, or BOOST_MY_LIBRARY_NO_LIB, or if this
|
||||||
# ifdef BOOST_WHATEVER_DYN_LINK
|
// is one of our own source files (signified by BOOST_MY_LIBRARY_SOURCE):
|
||||||
|
//
|
||||||
|
<b>#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
|
# define BOOST_DYN_LINK
|
||||||
# endif
|
# endif
|
||||||
# include <boost/config/auto_link.hpp>
|
# include <boost/config/auto_link.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
</b>...
|
||||||
</PRE>
|
</PRE>
|
||||||
|
</blockquote>
|
||||||
|
<p><b>my_library.cpp</b></p>
|
||||||
|
<blockquote>
|
||||||
|
<pre>// define BOOST_MY_LIBRARY_SOURCE so that the header knows that the
|
||||||
|
// library is being built (possibly exporting rather than importing code)
|
||||||
|
//
|
||||||
|
<b>#define BOOST_MY_LIBRARY_SOURCE</b>
|
||||||
|
|
||||||
|
<b>#include <boost/my_library/my_library.hpp></b>
|
||||||
|
...</pre>
|
||||||
|
</blockquote>
|
||||||
<H2>Guidelines for Boost Authors</H2>
|
<H2>Guidelines for Boost Authors</H2>
|
||||||
<p>The <a href="../../boost/config.hpp">boost/config.hpp</a> header is used to
|
<p>The <a href="../../boost/config.hpp">boost/config.hpp</a> header is used to
|
||||||
pass configuration information to other boost files, allowing them to cope with
|
pass configuration information to other boost files, allowing them to cope with
|
||||||
|
Reference in New Issue
Block a user