Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/bbv2/faq/dll-path.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 6.2 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Why are the dll-path and
5    hardcode-dll-paths properties useful?
6    </title>
7<link rel="stylesheet" href="../../boostbook.css" type="text/css">
8<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
9<style type="text/css">
10body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png');
11       background-repeat: no-repeat;
12       background-position: top left;
13       /* The following properties make the watermark "fixed" on the page. */
14       /* I think that's just a bit too distracting for the reader... */
15       /* background-attachment: fixed; */
16       /* background-position: center center; */
17     }</style>
18<link rel="start" href="../../index.html" title="The Boost C++ Libraries">
19<link rel="up" href="../faq.html" title="Chapter 27. Frequently Asked Questions">
20<link rel="prev" href="s07.html" title="How to change compilation flags for one file?
21    ">
22<link rel="next" href="../recipies/site-config.html" title="Targets in site-config.jam">
23</head>
24<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25<table cellpadding="2" width="100%">
26<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td>
27<td align="center"><a href="../../../../index.htm">Home</a></td>
28<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
29<td align="center"><a href="../../../../people/people.htm">People</a></td>
30<td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
31<td align="center"><a href="../../../../more/index.htm">More</a></td>
32</table>
33<hr>
34<div class="spirit-nav">
35<a accesskey="p" href="s07.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../recipies/site-config.html"><img src="../../images/next.png" alt="Next"></a>
36</div>
37<div class="section" lang="en">
38<div class="titlepage"><div><div><h2 class="title" style="clear: both">
39<a name="bbv2.faq.dll-path"></a>Why are the <code class="computeroutput">dll-path</code> and
40    <code class="computeroutput">hardcode-dll-paths</code> properties useful?
41    </h2></div></div></div>
42<p>(This entry is specific to Unix system.)Before answering the
43      questions, let's recall a few points about shared libraries. Shared
44      libraries can be used by several applications, or other libraries,
45      without phisycally including the library in the application. This can
46      greatly decrease the total size of applications. It's also possible to
47      upgrade a shared library when the application is already
48      installed. Finally, shared linking can be faster.
49    </p>
50<p>However, the shared library must be found when the application is
51      started. The dynamic linker will search in a system-defined list of
52      paths, load the library and resolve the symbols. Which means that you
53      should either change the system-defined list, given by the
54      <code class="envar">LD_LIBRARY_PATH</code> environment variable, or install the
55      libraries to a system location. This can be inconvenient when
56      developing, since the libraries are not yet ready to be installed, and
57      cluttering system paths is undesirable. Luckily, on Unix there's another
58      way.
59    </p>
60<p>An executable can include a list of additional library paths, which
61      will be searched before system paths. This is excellent for development,
62      because the build system knows the paths to all libraries and can include
63      them in executables. That's done when the <code class="computeroutput">hardcode-dll-paths</code>
64      feature has the <code class="literal">true</code> value, which is the
65      default. When the executables should be installed, the story is
66      different.
67    </p>
68<p>
69      Obviously, installed executable should not hardcode paths to your
70      development tree. (The <code class="computeroutput">stage</code> rule explicitly disables the
71      <code class="computeroutput">hardcode-dll-paths</code> feature for that reason.) However, you
72      can use the <code class="computeroutput">dll-path</code> feature to add explicit paths
73      manually. For example:
74</p>
75<pre class="programlisting">
76stage installed : application : &lt;dll-path&gt;/usr/lib/snake
77                                &lt;location&gt;/usr/bin ;         
78</pre>
79<p>
80      will allow the application to find libraries placed to
81      <code class="filename">/usr/lib/snake</code>.
82    </p>
83<p>If you install libraries to a nonstandard location and add an
84      explicit path, you get more control over libraries which will be used. A
85      library of the same name in a system location will not be inadvertently
86      used.  If you install libraries to a system location and do not add any
87      paths, the system administrator will have more control. Each library can
88      be individually upgraded, and all applications will use the new library.
89    </p>
90<p>Which approach is best depends on your situation. If the libraries
91      are relatively standalone and can be used by third party applications,
92      they should be installed in the system location. If you have lots of
93      libraries which can be used only by your application, it makes sense to
94      install it to a nonstandard directory and add an explicit path, like the
95      example above shows. Please also note that guidelines for different
96      systems differ in this respect. The Debian guidelines prohibit any
97      additional search paths, and Solaris guidelines suggest that they should
98      always be used.
99    </p>
100</div>
101<table width="100%"><tr>
102<td align="left"></td>
103<td align="right"><small></small></td>
104</tr></table>
105<hr>
106<div class="spirit-nav">
107<a accesskey="p" href="s07.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../recipies/site-config.html"><img src="../../images/next.png" alt="Next"></a>
108</div>
109</body>
110</html>
Note: See TracBrowser for help on using the repository browser.