Skip to content

Commit 73dcba0

Browse files
authored
Merge pull request SCons#4486 from mwichmann/doc/SharedLibrary
Update SharedLibrary docs
2 parents 38125c0 + 017e4a0 commit 73dcba0

File tree

3 files changed

+43
-26
lines changed

3 files changed

+43
-26
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
9595
would fail with an exception if called with a module which is
9696
not found. It will now return None. Updated manpage entry and
9797
docstring..
98+
- Improve SharedLibrary docs a bit.
9899

99100

100101
RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700

RELEASE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ DOCUMENTATION
8989
some more explantion. Clarified discussion of the scanner function in
9090
the Scanner Objects section of the manpage.
9191
- The manpage entry for Pseudo was clarified.
92+
- The manpage entry for SharedLibrary was clarified.
9293

9394
DEVELOPMENT
9495
-----------

SCons/Tool/Tool.xml

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,24 @@ env.Program(target='foo', source=['foo.o', 'bar.c', 'baz.f'])
150150
<summary>
151151
<para>
152152
Builds a shared library
153-
(<filename>.so</filename> on a POSIX system,
154-
<filename>.dll</filename> on Windows)
155153
given one or more object files
156-
or C, C++, D or Fortran source files.
157-
If any source files are given,
158-
then they will be automatically
159-
compiled to object files.
154+
and/or C, C++, D or Fortran source files.
155+
Any source files listed in the
156+
<parameter>source</parameter> parameter
157+
will be automatically
158+
compiled to object files suitable
159+
for use in a shared library.
160+
Any object files listed in the
161+
<parameter>source</parameter> parameter
162+
must have been built for a shared library
163+
(that is, using the
164+
&b-SharedObject;
165+
builder method).
166+
&scons;
167+
will raise an error if there is any mismatch.
168+
</para>
169+
170+
<para>
160171
The target library file prefix,
161172
specified by the &cv-link-SHLIBPREFIX; &consvar;
162173
(by default, <filename>lib</filename> on POSIX systems,
@@ -165,7 +176,13 @@ and suffix,
165176
specified by the &cv-link-SHLIBSUFFIX; &consvar;
166177
(by default, <filename>.dll</filename> on Windows systems,
167178
<filename>.so</filename> on POSIX systems),
168-
are automatically added to the target if not already present.
179+
are automatically added (if not already present)
180+
to the target name to make up the library filename.
181+
On a POSIX system, if the &cv-link-SHLIBVERSION; &consvar; is set,
182+
it is appended (following a period) to the resulting library name.
183+
</para>
184+
185+
<para>
169186
Example:
170187
</para>
171188

@@ -195,16 +212,6 @@ if there is not already a <filename>.dll.a</filename> file explicitly
195212
listed in the targets.
196213
</para>
197214

198-
<para>
199-
Any object files listed in the
200-
<parameter>source</parameter>
201-
must have been built for a shared library
202-
(that is, using the
203-
&b-SharedObject;
204-
builder method).
205-
&scons;
206-
will raise an error if there is any mismatch.
207-
</para>
208215

209216
<para>
210217
On some platforms, there is a distinction between a shared library
@@ -214,7 +221,7 @@ For maximum portability, use the &b-link-LoadableModule; builder for the latter.
214221
</para>
215222

216223
<para>
217-
When the &cv-link-SHLIBVERSION; &consvar; is defined, a versioned
224+
If &cv-link-SHLIBVERSION; is defined, a versioned
218225
shared library is created. This modifies &cv-link-SHLINKFLAGS; as required,
219226
adds the version number to the library name, and creates any
220227
symbolic links that are needed.
@@ -225,17 +232,25 @@ env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'], SHLIBVERSION='1.5.2')
225232
</example_commands>
226233

227234
<para>
228-
On a POSIX system, versions with a single token create exactly one symlink:
229-
<filename>libbar.so.6</filename> would have symlink <filename>libbar.so</filename> only.
230-
On a POSIX system, versions with two or more
231-
tokens create exactly two symlinks: <filename>libbar.so.2.3.1</filename> would have symlinks
232-
<filename>libbar.so</filename> and <filename>libbar.so.2</filename>; on a Darwin (OSX) system the library would be
233-
<filename>libbar.2.3.1.dylib</filename> and the link would be <filename>libbar.dylib</filename>.
235+
On a POSIX system, supplying a simple version string (no dots)
236+
creates exactly one symbolic link: <literal>SHLIBVERSION="1"</literal>
237+
would create (for example) library <filename>libbar.so.1</filename>
238+
and symbolic link <filename>libbar.so</filename>.
239+
Supplying a dotted version string will create two symbolic links
240+
(irrespective of the number of segments in the version):
241+
<literal>SHLIBVERSION="1.5.2"</literal> for the same library
242+
would create library <filename>libbar.so.1.5.2</filename>
243+
and symbolic links <filename>libbar.so</filename> and
244+
<filename>libbar.so.1</filename>. A Darwin (OSX)
245+
system creates one symlink in either case,
246+
for the second example the library would be
247+
<filename>libbar.1.5.2.dylib</filename>
248+
and the link would be <filename>libbar.dylib</filename>.
234249
</para>
235250

236251
<para>
237-
On Windows systems, specifying
238-
<parameter>register=1</parameter>
252+
On Windows systems, specifying the
253+
<parameter>register=1</parameter> keyword argument
239254
will cause the <filename>.dll</filename> to be
240255
registered after it is built.
241256
The command that is run is determined by the &cv-link-REGSVR; &consvar;

0 commit comments

Comments
 (0)