1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Getting Started</title> 5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Chapter 1. Boost.LocalFunction 1.0.0"> 8<link rel="up" href="../index.html" title="Chapter 1. Boost.LocalFunction 1.0.0"> 9<link rel="prev" href="../index.html" title="Chapter 1. Boost.LocalFunction 1.0.0"> 10<link rel="next" href="tutorial.html" title="Tutorial"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 27<a name="boost_localfunction.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting Started</a> 28</h2></div></div></div> 29<div class="toc"><dl class="toc"> 30<dt><span class="section"><a href="getting_started.html#boost_localfunction.getting_started.this_documentation">This 31 Documentation</a></span></dt> 32<dt><span class="section"><a href="getting_started.html#boost_localfunction.getting_started.compilers_and_platforms">Compilers 33 and Platforms</a></span></dt> 34<dt><span class="section"><a href="getting_started.html#boost_localfunction.getting_started.installation">Installation</a></span></dt> 35</dl></div> 36<p> 37 This section explains how to setup a system to use this library. 38 </p> 39<div class="section"> 40<div class="titlepage"><div><div><h3 class="title"> 41<a name="boost_localfunction.getting_started.this_documentation"></a><a class="link" href="getting_started.html#boost_localfunction.getting_started.this_documentation" title="This Documentation">This 42 Documentation</a> 43</h3></div></div></div> 44<p> 45 Programmers should have enough knowledge to use this library after reading 46 the <a class="link" href="../index.html#boost_localfunction.introduction" title="Introduction">Introduction</a>, 47 <a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>, 48 and <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a> sections. 49 The <a class="link" href="advanced_topics.html" title="Advanced Topics">Advanced Topics</a> 50 and <a href="../reference.html" target="_top">Reference</a> sections can be consulted 51 at a later point to gain a more advanced knowledge of the library. All the 52 other sections of this documentation can be considered optional. 53 </p> 54<p> 55 Some footnotes are marked by the word "<span class="bold"><strong>Rationale</strong></span>". 56 They explain reasons behind decisions made during the design and implementation 57 of this library. 58 </p> 59<p> 60 In most of the examples presented in this documentation, the Boost.Detail/LightweightTest 61 (<code class="literal">boost/detail/lightweight_test.hpp</code>) macro <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code> is used to check correctness 62 conditions. The <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code> 63 macro is conceptually similar to <code class="computeroutput"><span class="identifier">assert</span></code> 64 but a failure of the checked condition does not abort the program, instead 65 it makes <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span></code> return a non-zero program 66 exit code. <a href="#ftn.boost_localfunction.getting_started.this_documentation.f0" class="footnote" name="boost_localfunction.getting_started.this_documentation.f0"><sup class="footnote">[3]</sup></a> 67 </p> 68</div> 69<div class="section"> 70<div class="titlepage"><div><div><h3 class="title"> 71<a name="boost_localfunction.getting_started.compilers_and_platforms"></a><a class="link" href="getting_started.html#boost_localfunction.getting_started.compilers_and_platforms" title="Compilers and Platforms">Compilers 72 and Platforms</a> 73</h3></div></div></div> 74<p> 75 The implementation of this library uses preprocessor and template meta-programming 76 (as supported by <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a> 77 and <a href="http://www.boost.org/libs/mpl" target="_top">Boost.MPL</a>), templates 78 with partial specializations and function pointers (similarly to <a href="http://www.boost.org/libs/function" target="_top">Boost.Function</a>), 79 and automatic type deduction (as supported by <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a>). 80 The authors originally developed and tested the library on: 81 </p> 82<div class="orderedlist"><ol class="orderedlist" type="1"> 83<li class="listitem"> 84 GNU Compiler Collection (GCC) C++ 4.5.1 on Ubuntu Linux 10. 85 </li> 86<li class="listitem"> 87 GCC 4.3.4 and 4.5.3 (with and without <a href="http://www.open-std.org/JTC1/SC22/WG21/" target="_top">C++11</a> 88 features enabled <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">c</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span></code>) 89 on Cygwin. 90 </li> 91<li class="listitem"> 92 Miscrosoft Visual C++ (MSVC) 8.0 on Windows XP and Windows 7. 93 </li> 94</ol></div> 95<p> 96 See the library <a href="http://www.boost.org/development/tests/release/developer/local_function.html" target="_top">regressions 97 test results</a> for detailed information on supported compilers and 98 platforms. 99 </p> 100</div> 101<div class="section"> 102<div class="titlepage"><div><div><h3 class="title"> 103<a name="boost_localfunction.getting_started.installation"></a><a class="link" href="getting_started.html#boost_localfunction.getting_started.installation" title="Installation">Installation</a> 104</h3></div></div></div> 105<p> 106 This library is composed of header files only. Therefore there is no pre-compiled 107 object file which needs to be installed or linked. Programmers can simply 108 instruct the C++ compiler where to find the library header files (<code class="computeroutput"><span class="special">-</span><span class="identifier">I</span></code> option 109 for GCC, <code class="computeroutput"><span class="special">/</span><span class="identifier">I</span></code> 110 option for MSVC, etc) and they can start compiling code using this library. 111 </p> 112<p> 113 The library implementation uses <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a> 114 to automatically deduce the types of bound variables (see the <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a> 115 section). In order to compile code in type-of emulation mode, all types should 116 be properly registered using <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TYPE</span></code> 117 and <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TEMPLATE</span></code>, 118 or appropriate <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a> 119 headers should be included (see the source code of most examples presented 120 in this documentation). 121 </p> 122<p> 123 The followings are part of the library private API, they are not documented, 124 and they should not be directly used by programmers: <a href="#ftn.boost_localfunction.getting_started.installation.f0" class="footnote" name="boost_localfunction.getting_started.installation.f0"><sup class="footnote">[4]</sup></a> 125 </p> 126<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 127<li class="listitem"> 128 Any symbol defined by files within the <code class="literal">boost/local_function/aux_/</code> 129 or <code class="literal">boost/local_function/detail/</code> directory (these header 130 files should not be directly included by programmers). 131 </li> 132<li class="listitem"> 133 Any symbol within the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local_function</span><span class="special">::</span><span class="identifier">aux</span></code> 134 or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local_function</span><span class="special">::</span><span class="identifier">detail</span></code> namespace. 135 </li> 136<li class="listitem"> 137 Any symbol prefixed by <code class="computeroutput"><span class="identifier">boost_local_function_aux_</span><span class="special">...</span></code> or <code class="computeroutput"><span class="identifier">boost_local_function_detail_</span><span class="special">...</span></code> (regardless of its namespace). 138 </li> 139<li class="listitem"> 140 Any symbol prefixed by <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION_AUX_</span><span class="special">...</span></code> or <code class="computeroutput"><span class="identifier">BOOST_LOCAL_FUNCTION_DETAIL_</span><span class="special">...</span></code> (regardless of its namespace). 141 </li> 142</ul></div> 143<p> 144 Some of the library behaviour can be changed at compile-time by defining 145 special <span class="emphasis"><em>configuration macros</em></span>. If a configuration macro 146 is left undefined, the library will use an appropriate default value for 147 it. All configuration macros are defined in the header file <code class="computeroutput">boost/local_function/config.hpp</code>. 148 It is strongly recommended not to change the library configuration macro 149 definitions unless strictly necessary. 150 </p> 151</div> 152<div class="footnotes"> 153<br><hr style="width:100; text-align:left;margin-left: 0"> 154<div id="ftn.boost_localfunction.getting_started.this_documentation.f0" class="footnote"><p><a href="#boost_localfunction.getting_started.this_documentation.f0" class="para"><sup class="para">[3] </sup></a> 155 <span class="bold"><strong>Rationale.</strong></span> Using Boost.Detail/LightweightTest 156 allows to add the examples to the library regression tests so to make sure 157 that they always compile and run correctly. 158 </p></div> 159<div id="ftn.boost_localfunction.getting_started.installation.f0" class="footnote"><p><a href="#boost_localfunction.getting_started.installation.f0" class="para"><sup class="para">[4] </sup></a> 160 <span class="bold"><strong>Rationale.</strong></span> This library concatenates symbols 161 specified by the programmers (e.g., the local function name) with other 162 symbols (e.g., special prefixes or file line numbers) to make internal 163 symbols with unique names to avoid name clashes. These symbols are separated 164 by the letter "<code class="computeroutput"><span class="identifier">X</span></code>" 165 when they are concatenated so they read more easily during debugging (the 166 underscore character "<code class="computeroutput"><span class="identifier">_</span></code>" 167 could not be used instead of the letter "<code class="computeroutput"><span class="identifier">X</span></code>" 168 because if the original symbols already contained a leading or trailing 169 underscore, the concatenation could result in a symbol with double underscores 170 "<code class="computeroutput"><span class="identifier">__</span></code>" which is 171 reserved by the C++ standard). The "aux" symbols are private 172 to this library while the "detail" symbols may be used within 173 Boost by other libraries but they are still not part of this library public 174 API. 175 </p></div> 176</div> 177</div> 178<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 179<td align="left"></td> 180<td align="right"><div class="copyright-footer">Copyright © 2009-2012 Lorenzo 181 Caminiti<p> 182 Distributed under the Boost Software License, Version 1.0 (see accompanying 183 file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 184 </p> 185</div></td> 186</tr></table> 187<hr> 188<div class="spirit-nav"> 189<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 190</div> 191</body> 192</html> 193