mirror of https://github.com/tLDP/LDP
updated
This commit is contained in:
parent
299fbe27ec
commit
cebbe34e94
|
@ -10,7 +10,7 @@
|
|||
<author><firstname>David A.</firstname> <surname>Wheeler</surname>
|
||||
</author>
|
||||
<address><email>dwheeler@dwheeler.com</email></address>
|
||||
<pubdate>v1.04, 2 August 2002</pubdate>
|
||||
<pubdate>version 1.07, 30 December 2002</pubdate>
|
||||
<abstract>
|
||||
<para>
|
||||
This HOWTO for programmers
|
||||
|
@ -164,6 +164,18 @@ You can use a static library by invoking it as part of the compilation
|
|||
and linking process when creating a program executable.
|
||||
If you're using gcc(1) to generate your executable, you can use the -l
|
||||
option to specify the library; see info:gcc for more information.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Be careful about the order of the parameters when using gcc;
|
||||
the -l option is a linker option, and thus needs to be placed
|
||||
AFTER the name of the file to be compiled.
|
||||
This is quite different from the normal option syntax.
|
||||
If you place the -l option before the filename, it may fail to link at all,
|
||||
and you can end up with mysterious errors.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can also use the linker ld(1) directly, using its -l and -L options;
|
||||
however, in most cases it's better to use gcc(1) since the interface of
|
||||
ld(1) is more likely to change.
|
||||
|
@ -515,6 +527,11 @@ First, create the object files that will go into the shared
|
|||
library using the gcc -fPIC or -fpic flag.
|
||||
The -fPIC and -fpic options enable ``position independent code'' generation,
|
||||
a requirement for shared libraries; see below for the differences.
|
||||
You pass the soname using the -Wl gcc option.
|
||||
The -Wl option passes options
|
||||
along to the linker (in this case the -soname linker option) -
|
||||
the commas after -Wl are not a typo, and you
|
||||
must not include unescaped whitespace in the option.
|
||||
Then create the shared library using this format:
|
||||
</para>
|
||||
|
||||
|
@ -1168,6 +1185,29 @@ info:ld#Option Commands.
|
|||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="version-scripts">
|
||||
<title>Symbol Versioning and Version Scripts</title>
|
||||
<para>
|
||||
Typically references to external functions are bound on an as-needed basis,
|
||||
and are not all bound when the application starts up.
|
||||
If a shared library is out of date, a required interface may
|
||||
be missing; when the application tries to use that interface,
|
||||
it may suddenly and unexpectedly fail.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A solution to this problem are symbol versioning coupled with
|
||||
version scripts.
|
||||
With symbol versioning,
|
||||
the user can get a warning when they start their program if
|
||||
the libraries being used with the application are too old.
|
||||
You can learn more about this from ld manual's descussion of
|
||||
version scripts at
|
||||
<ulink url="http://www.gnu.org/manual/ld-2.9.1/html_node/ld_25.html">
|
||||
http://www.gnu.org/manual/ld-2.9.1/html_node/ld_25.html</ulink>.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="gnu-libtool">
|
||||
<title>GNU libtool</title>
|
||||
<para>
|
||||
|
@ -1284,6 +1324,51 @@ ready for the desktop (by Waldo Bastian)</ulink>
|
|||
for more information.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="lsb">
|
||||
<title>Linux Standard Base (LSB)</title>
|
||||
<para>
|
||||
The goal of the Linux Standard Base (LSB) project
|
||||
is to develop and promote a set of standards that will
|
||||
increase compatibility among Linux distributions and
|
||||
enable software applications to run on any compliant Linux system.
|
||||
The project's home page is at
|
||||
<ulink url="http://www.linuxbase.org">http://www.linuxbase.org</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
A nice article that summarizes how to develop LSB-compliant applications
|
||||
was published in October 2002,
|
||||
<ulink url="http://www-106.ibm.com/developerworks/linux/library/l-lsb.html?t=gr,lnxw02=LSBapps">Developing LSB-certified applications:
|
||||
Five steps to binary-compatible Linux applications</ulink>
|
||||
by George Kraft IV
|
||||
(Senior software engineer, IBM's Linux Technology Center).
|
||||
Of course, you need to write code that only accesses the standardized
|
||||
portability layer if you want your code to be portable.
|
||||
In addition, the LSB provides some tools so that application writers of C/C++
|
||||
programs can check for LSB compliance; these tools use some capabilities
|
||||
of the linker and special libraries to do these checks.
|
||||
Obviously, you'll need to install the tools to do these checks;
|
||||
you can get them from the LSB website.
|
||||
Then, simply use the "lsbcc" compiler as your C/C++ compiler
|
||||
(lsbcc internally creates a linking environment that will complain if
|
||||
certain LSB rules aren't followed):
|
||||
<programlisting>
|
||||
$ CC=lsbcc make myapplication
|
||||
(or)
|
||||
$ CC=lsbcc ./configure; make myapplication
|
||||
</programlisting>
|
||||
You can then use the lsbappchk program to ensure that
|
||||
the program only uses functions standardized by the LSB:
|
||||
<programlisting>
|
||||
$ lsbappchk myapplication
|
||||
</programlisting>
|
||||
You also need to follow the LSB packaging guidelines
|
||||
(e.g., use RPM v3, use LSB-conforming package names, and
|
||||
for add-on software must install in /opt by default).
|
||||
See the article and LSB website for more information.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="more-examples">
|
||||
|
@ -1580,6 +1665,17 @@ Hongjui Lu. This gives Linux and GNU gcc-specific information on ELF, and is
|
|||
available at
|
||||
<ulink url="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz">ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz</ulink>.
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>
|
||||
The ld documentation ``Using LD, the GNU Linker'' describes ld in
|
||||
far more detail.
|
||||
It is available at
|
||||
<ulink url="http://www.gnu.org/manual/ld-2.9.1">
|
||||
http://www.gnu.org/manual/ld-2.9.1</ulink>.
|
||||
</para></listitem>
|
||||
|
||||
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!-- This is the Linux Swap-Space Mini-HOWTO, SGML source -- >
|
||||
<!-- Rahul Sundaram >
|
||||
<!-- This is the Linux Swap-Space Sharing with Windows HOWTO, SGML source -- >
|
||||
<!-- Rahul Sundaram -->
|
||||
<!-- Version 1.5 -- >
|
||||
|
||||
<!doctype linuxdoc system>
|
||||
|
@ -7,59 +7,60 @@
|
|||
<article>
|
||||
|
||||
<title>Linux Swap Space Mini-HOWTO
|
||||
<author>Rahul Sundaram <url url="mailto:rahulsundaram@yahoo.co.in" name="rahulsundaram@yahoo.co.in">
|
||||
<date>v1.5, 2002-07-06
|
||||
<author>Rahul Sundaram <url url="mailto:rahulsundaram AT yahoo DOT co DOT in" name="rahulsundaram@yahoo.co.in">
|
||||
<date>v1.6, 2002-12-27
|
||||
<abstract>
|
||||
This Linux Mini-HOWTO describes how to share your Linux swap partition with
|
||||
This Linux Mini-HOWTO describes how to share your Linux swap partition with
|
||||
Windows.
|
||||
</abstract>
|
||||
<toc>
|
||||
<sect>Introduction
|
||||
<p>
|
||||
Many people use both Linux and MS-Windows. The ability to do so is an
|
||||
important part of "the Linux revolution"; i.e. letting people
|
||||
experiment with (and get hooked on) Linux while still being able to
|
||||
run their off-the-shelf software. Since both Linux and MS-Windows use
|
||||
virtual memory with swap to disk, a frequently occurring question in
|
||||
comp.os.linux.setup is how to share swap spaces, in order to reduce the
|
||||
amount of disk space needed.
|
||||
|
||||
There are several methods for sharing swap spaces, the one described
|
||||
in this document is probably the most complicated one but is the only
|
||||
one I have encountered that allows maximum performance for both
|
||||
<sect>Introduction
|
||||
<p>
|
||||
Many people use both Linux and MS-Windows. The ability to do so is an
|
||||
important part of "the Linux revolution"; i.e. letting people
|
||||
experiment with (and get hooked on) Linux while still being able to
|
||||
run their off-the-shelf software. Since both Linux and MS-Windows use
|
||||
virtual memory with swap to disk, a frequently occurring question in
|
||||
comp.os.linux.setup is how to share swap spaces, in order to reduce the
|
||||
amount of disk space needed.
|
||||
|
||||
There are several methods for sharing swap spaces, the one described
|
||||
in this document is probably the most complicated one but is the only
|
||||
one I have encountered that allows maximum performance for both
|
||||
environments without the risk of trashing a disk partition. If you are
|
||||
using DOS, then many DOS applications manage their own swap files. You
|
||||
can also share the Linux swap partition with these applications.
|
||||
|
||||
|
||||
<sect> What you need
|
||||
<p>
|
||||
This procedure have a few requirements that need to be filled. I
|
||||
strongly recommend that you fill these requirements *anyway*, as there
|
||||
are several problems with older versions.
|
||||
|
||||
<sect> What you need
|
||||
<p>
|
||||
This procedure have a few requirements that need to be filled. I
|
||||
strongly recommend that you fill these requirements *anyway*, as there
|
||||
are several problems with older versions.
|
||||
|
||||
<p>
|
||||
<enum>
|
||||
<item>
|
||||
MS-DOS 5.0 or newer and MS-Windows 3.1/3.11 <bf>OR</bf> MS-Windows 95/98
|
||||
<item>
|
||||
A shutdown/init that knows to run a file on shutdown.
|
||||
(The SysVinit-2.50 package can do this, for example.
|
||||
SysVinit-2.50 is available from sunsite.unc.edu in
|
||||
/pub/Linux/system/Daemons. Almost all current distributions
|
||||
use this init package.)
|
||||
<item>
|
||||
MS-DOS 5.0 or newer and MS-Windows 3.1/3.11 <bf>OR</bf> MS-Windows 95/98
|
||||
<item>
|
||||
A shutdown/init that knows to run a file on shutdown.
|
||||
(The SysVinit-2.50 package can do this, for example.
|
||||
SysVinit-2.50 is available from sunsite.unc.edu in
|
||||
/pub/Linux/system/Daemons. Almost all current distributions
|
||||
use this init package.)
|
||||
</enum>
|
||||
</p>
|
||||
|
||||
|
||||
<sect> Recent Changes and versions
|
||||
<p>
|
||||
<itemize>
|
||||
<item> Version 1.3 -- Written by H. Peter Anvin, and was not maintained
|
||||
from 15 Jan 1998.
|
||||
<item> Version 1.4 -- Based on v1.3, but added more details.Rahul U. Joshi started maintainance
|
||||
<item> Version 1.42 -- Deleted the recovery section for v1.4 users an v1.4
|
||||
<item> Version 1.42 -- Deleted the recovery section for v1.4 users an v1.4
|
||||
never actually appeared on the LDP website.
|
||||
<item> Version 5 -- Rahul U.Joshi stopped maintainance on 18 January 2000.Currently being maintained by Rahul Sundaram.
|
||||
<item> Version 1.5 -- Rahul U.Joshi stopped maintainance on 18 January 2000.Currently being maintained by Rahul Sundaram.
|
||||
<item> Version 1.6 -- Renamed from Linux Swap space to this one.
|
||||
</itemize>
|
||||
</p>
|
||||
|
||||
|
@ -83,19 +84,19 @@ Date: 26 Nov 1999
|
|||
</itemize>
|
||||
</p>
|
||||
|
||||
|
||||
<sect>Administrative
|
||||
|
||||
<sect>Administrative
|
||||
<sect1>Copyright
|
||||
<p>
|
||||
This mini-HOWTO is Copyright © Rahul Sundaram.All rights reserved.This document is licensed under
|
||||
the <url url="http://tldp.org/copyright.html" name="Linux Documentation Project license">.I welcome any kind of commercial distrubution but I would like to receive information regarding this.I would
|
||||
This mini-HOWTO is Copyright Rahul Sundaram.All rights reserved.This document is licensed under
|
||||
the <url url="http://tldp.org/copyright.html" name="Linux Documentation Project license">.I welcome any kind of commercial distrubution but I would like to receive information regarding this.I would
|
||||
also help anyone willing to translate this document.If you require any exceptions to the licensing terms
|
||||
please contact me <url url="mailto:rahulsundaram@yahoo.co.in" name="Rahul">. The latest version of this document is always available at the Linux Documentation
|
||||
please contact me <url url="mailto:rahulsundaram AT yahoo DOT co DOT in" name="Rahul Sundaram">. The latest version of this document is always available at the Linux Documentation
|
||||
website at <url url="http://tldp.org/HOWTO/mini/Automount.html">.
|
||||
|
||||
<sect1>Disclaimer
|
||||
<p>
|
||||
Although I have tried my best to bring out various facts, the author is
|
||||
Although I have tried my best to bring out various facts, the author is
|
||||
not responsible for any damage due to the actions taken based upon the
|
||||
information contained in this document. It is impossible to test the
|
||||
things under all the configurations, so probably some of the hints given
|
||||
|
@ -1200,10 +1201,11 @@ Rahul Sundaram.
|
|||
|
||||
I rely on you, the readers, to make this HOWTO useful. If you have any
|
||||
suggestions, comments, corrections, requests, flames, etc., feel free to
|
||||
contact <url url="mailto:rahulsundaram@yahoo.co.in" name="Rahul Sundaram">.
|
||||
contact <url url="mailto:rahulsundaram AT yahoo DOT co DOT in" name="Rahul Sundaram">.
|
||||
I dedicate this document to my friends.
|
||||
|
||||
</p>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue