Issue Details (XML | Word | Printable)

Key: STDCXX-895
Type: New Feature New Feature
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

[HP-UX] use the +h ld option to record internal library name

Created: 25/Apr/08 07:40 PM   Updated: 25/Apr/08 07:48 PM
Return to search
Component/s: Build and Installation
Affects Version/s: 4.2.0, 4.2.1
Fix Version/s: 4.2.2

Time Tracking:
Original Estimate: 2h
Original Estimate - 2h
Remaining Estimate: 2h
Remaining Estimate - 2h
Time Spent: Not Specified
Remaining Estimate - 2h

Environment: HP-UX

Severity: Incorrect Behavior


 Description  « Hide
The HP-UX Linker and Libraries User's Guide: HP 9000 Computers (see also this document) recommends using the linker's +h internal_name option to designate the internal name of the library. We should follow that recommendation.

Quoting from Version Control with Shared Libraries:

Library-Level Versioning

HP-UX 10.0 adds a new library-level versioning scheme that allows you to maintain multiple versions of shared libraries when you make incompatible changes to the library. By maintaining multiple versions, applications linked with the older versions continue to run with the older libraries, while new applications link and run with the newest version of the library. Library-level versioning is very similar to the library versioning on UNIX System V Release 4.

How to Use Library-Level Versioning

To use library-level versioning, follow these steps:

  1. Name the first version of your shared library with an extension of .0 (that's the number zero), for example libA.0. Use the +h option to designate the internal name of the library, for example, libA.0:
          ld -b *.o -o libA.0 +h libA.0      Creates the shared library libA.0. 
    
  2. Since the linker still looks for libraries ending in .sl with the -l option, create a symbolic link from the usual name of the library ending in .sl to the actual library. For example, libA.sl points to libA.0:
          ln -s libA.0 libA.sl                 libA.sl is a symbolic link to libA.0.
    
  3. Link applications as usual, using the -l option to specify libraries. The linker searches for libA.sl, as usual. However, if the library it finds has an internal name, the linker places the internal name of the library in the executable's shared library dependency list. When you run the application, the dynamic loader loads the library named by this internal name. For example:
          ld /opt/langtools/lib/crt0.o prog.o -lA -lc Binds a.out with libA.0.
    


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor added a comment - 25/Apr/08 07:48 PM
Also, it's recommended that on HP-UX/IPF the shared library extension be .so rather than the .sl that's conventional on PA-RISC. We should make the change when appropriate (probably 4.3) and perhaps provide a .sl link for compatibility.