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 libmyown.sl:
$ ln s libmyown.0 libmyown.sl $ ls l libmyown.sl $ libmyown.sl -> libmyown.0
To link with the library, use the -l option to specify the library. The linker (ld) searches for the file libmyown.sl. 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 libmyown.sl. 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
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.