diff --git a/separate_compilation.html b/separate_compilation.html index 7a81fd4..3425be5 100644 --- a/separate_compilation.html +++ b/separate_compilation.html @@ -5,18 +5,17 @@ - - - - - - -
-

C++ Boost

-
-

Guidelines for Authors of Boost Libraries Containing Separate - Source

-
+ + + + + +
+

C++ Boost

+
+

Guidelines for Authors of Boost Libraries Containing Separate + Source

+


These guidelines are designed for the authors of Boost libraries which have @@ -25,24 +24,23 @@ occurrences of "whatever" or "WHATEVER" with your own library's name when copying the examples.

Contents

- -
-
Changes Affecting Source Code -
-
-
Preventing Compiler ABI Clashes
Supporting - Windows Dll's
Automatic Library Selection and Linking - with auto_link.hpp
-
-
Changes Affecting the Build System -
-
-
Creating the Library Jamfile
Testing - Auto-linking
-
-
Copyright
-
- +
+
Changes Affecting Source Code +
+
+
Preventing Compiler ABI Clashes
Static + or Dymanic Libraries 
Supporting Windows Dll's
+ Automatic Library Selection and Linking with auto_link.hpp +
+
+
Changes Affecting the Build System +
+
+
Creating the Library Jamfile
Testing + Auto-linking
+
+
Copyright
+

Changes Affecting Source Code

Preventing Compiler ABI Clashes

There are some compilers (mostly Microsoft Windows compilers again!), which @@ -103,10 +101,19 @@ whatever get_whatever(); #endif -

You can include this code in your source files as well if you want - although - you probably shouldn't need to - these headers fix the ABI to the default used - by the compiler, and if the user attempts to compile the source with any other - setting then they will get compiler errors if there are any conflicts.

+

You can include this code in your library source files as well if you want, + although you probably shouldn't need to:  

+

Rationale:

Without some means of managing this issue, users often report bugs along the line of "Your silly library always crashes when I try and call it" and so on. @@ -124,7 +131,38 @@ whatever get_whatever(); shared_ptr.hpp also uses them. Authors of header-only boost libraries may not be so keen on this solution - with some justification - since they don't face the same problem.

-

Supporting Windows Dll's

+

Static or Dynamic Libraries

+

When the users runtime is dynamically linked the Boost libraries can be built + either as dynamic libraries (.so's on Unix platforms, .dll's on Windows) or as + static libraries (.a's on Unix, .lib's on Windows).  So we have a choice + as to which is supported by default:

+ +

The recomendation is to pick static linking by default.

+

Rationale:

+

There is no one policy that fits all here. +

+

The rationale for the current behaviour was inherited from Boost.Regex (and + it's ancestor regex++): this library originally used dynamic linking by + default whenever the runtime was dynamic. It's actually safer that way should + you be using regex from a dll for example. However, this + behavior brought a persistent stream of user complaints: mainly about + deployment, all asking if static linking could be the default. After regex + changed behavior the complaints stopped, and the author hasn't had one + complaint about static linking by default being the wrong choice.

+

Note that other libraries might need to make other choices: for example + libraries that are intended to be used to implement dll pluggin's would like + need to use dynamic linking in almost all cases.

+

Supporting Windows Dll's

On most Unix-like platforms no special annotations of source code are required in order for that source to be compiled as a shared library because all external symbols are exposed. However the majority of Windows compilers require @@ -311,7 +349,6 @@ libboost_regex-vc71-sgd-1_31.lib #include <boost/config/auto_link.hpp> #endif // auto-linking disabled -

The library's user documentation should note that the feature can be disabled by defining either BOOST_ALL_NO_LIB or BOOST_WHATEVER_NO_LIB:

If for any reason you need to debug this feature, the header @@ -442,12 +479,12 @@ run 26 November, 2003

© Copyright John Maddock 1998- 2003

-

Distributed under the Boost Software License, Version 1.0. (See - accompanying file LICENSE_1_0.txt or copy - at http://www.boost.org/LICENSE_1_0.txt)

+

Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt)

The use of code snippets from this article does not require the reproduction of this copyright notice and license declaration; if you wish to provide attribution then please provide a link to this article.

+