Section 6.5. Library Versioning

6.5. Library Versioning

If the architecture of the application to be ported requires versioning support for libraries, some porting effort will be needed to convert the application to use the Linux library versioning implementation.

6.5.1. Library Versioning on HP-UX

Library versioning support is provided in the HP-UX development environment through the use of the +h linker (ld) option. Take, for example, a library named libmyown. To create a version 0 library for libmyown, the command line will look like this:

$ ld -b *.o -o libmyown.0 +h libmyown.0 

The resulting library, libmyown.0, is produced with an internal name of libmyown.0 represented by the +h flag and its argument. After the shared library, libmyown.0, is produced, it is ready to be placed in its destination directoryin this case, assume /tmp is the destination directory. To install the library to /tmp, copy libmyown.0 to /tmp and use the command ln to link it to a file named

$ ln s libmyown.0 $ ls l $ -> libmyown.0 

To link with the library, use the -l option to specify the library. The linker (ld) searches for the file Because the library was created with an internal name, the linker places the internal name of the library in the executable's shared library dependency list. When the application is run, the dynamic loader (dl) loads the library named by this internal namein this case, libmyown.0.

If another version of libmyown is created and named libmyown.1, the preceding procedure for creating a version library using the +h flag is repeated to produce libmyown.1. The shared library libmyown.1 is linked (using the ln command) with Any new programs linked with libmyown .sl will be linked with and use libmyown.1. Old programs that were linked to libmyown.0 will continue using libmyown.0.

6.5.2. Library Versioning on Linux[24]

[24] Refer to the paper "Library Versioning in Solaris and Linux" published in the Proceedings of the 4th Annual Linux Showcase and Conference, Atlanta, October 1014, 2000.

Two types of versioning exist on Linuxexternal and symbol versioning. External versioning closely resembles HP-UX semantics; the internal versioning exists to replicate versioning semantics supported by other operating systems such as Solaris. See Chapter 3 for a complete discussion of the library versioning available on Linux.

UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175 © 2008-2017.
If you may any questions please contact us: