search    
HP aC++ Online Programmer's Guide
Hewlett-Packard
Distributing Your C++ Products
Distribute your products in such a way that your customer does not need to use the HP aC++ compiler or driver. That is, distribute only executables and shared libraries. Be sure your customer has read this distribution information.

If you write code in HP aC++ and distribute any of the following C++ files to your customers, read all of the following sections for recommendations and legal requirements.

  • Shared libraries containing C++ code except the following, which are provided as part of the HP-UX core system:
    • /usr/lib/libCsup.sl (and libCsup_v2.sl)
    • /usr/lib/libstd.sl (and libstd_v2.sl)
    • /usr/lib/librwtool.sl (and librwtool_v2.sl)
    • /usr/lib/libstream.sl
    • The corresponding libraries in /usr/lib/pa20_64/.
  • Executable files produced by HP aC++ and applications that use shared libraries provided with HP aC++.
  • Object files produced by HP aC++.
  • Archived libraries containing C++ code.
  • Any combination of the above.
Note: If you choose to distribute archive libraries or object files, your customer must have purchased HP aC++.

This section is organized into the following topics:

Applications that use HP aC++ Shared Libraries
The following HP aC++ run-time libraries are shipped as part of the HP-UX 11.x core system:
  • /usr/lib/libCsup.sl and libCsup_v2.sl
  • /usr/lib/libstd.sl and libstd_v2.sl
  • /usr/lib/libstd_v2.sl and librwtool_v2.sl
  • /usr/lib/libstream.sl
  • The corresponding libraries in /usr/lib/pa20_64/.
Note: If you distribute either executable files or shared libraries as part of your product, you should not ship the above HP aC++ runtime libraries with your product in such a way that it results in overwriting a newer library version with an older, incompatible version. If you ship any HP aC++ run-time library, then it is your responsibility to ensure that an old library version is not installed over a new one.

Linking Your HP aC++ Libraries with Other Languages
This section discusses what you and your customers need to do if your product is an HP aC++ library to be called with another language.

The C++ language requires that nonlocal static objects be initialized before any function or object is used. HP aC++ initializes nonlocal static objects in all object files, including shared libraries, before the first statement in main() executes. If you distribute HP aC++ libraries that your customers will use, they must do the following to ensure that nonlocal static objects are correctly initialized and destroyed:

NOTE: Calling _main() is optional starting with the A.03.33 aC++ runtime. Corresponding dld and libc patches are also required:
     PHSS_24638, PHSS_24304 and PHCO_24942 or later for 11.11
     PHSS_24627, PHSS_24303 and PHCO_24723 or later for 11.0

  • Your customer must have purchased HP aC++ and must link their code with the aCC command.

     

  • If your customer's main program is written in a language other than C++, your customer's main program must first call _main() before doing anything else. _main() calls all nonlocal static constructors.

    NOTE: 64-bit mode differs from the above. In 64-bit mode, your code must not call _main.

If your libraries are C++ shared libraries, the above restrictions can be relaxed as follows:
  • _main() must still be called, before any use of aC++ code. It could be placed in the C++ library itself.

    NOTE: 64-bit mode differs from the above. In 64-bit mode, your code must not call _main.

     

  • The a.out must be linked with:
    /usr/lib/libcl.sl  (or on the link line -lcl)
    

     

  • Except when dynamically loading the C++ shared library, the a.out must be linked with the HP aC++ runtime libraries in the following order:
    -AP:   -lstd -lstream -lCsup -lm -lcl -ldld
    -AA:   -lstd_v2 -lCsup_v2 -lm -lcl -ldld
    
    If the library is being dynamically loaded from pure C or Java as a plugin, the library should be linked with the HP aC++ runtime libraries in the following order:
    -AP:   -lstd -lstream -lCsup -lm
    -AA:   -lstd_v2 -lCsup_v2 -lm
    
  • If the library does not use libstd (STL) or libstream (iostreams), then they can be eliminated. If tools.h++ is used, then add -lrwtool (or -lrwtool_v2) to the left.

     

  • The following stub file needs to be linked into the shared library or every a.out. Assemble as follows:

    NOTE: This stub is optional starting with the A.03.30 aC++ runtime.
          PHSS_22898 or later for 11.11
          PHSS_22543 or later for 11.0

    as cpprt0_stub.s 
    
    or
    cc -c cpprt0_stub.s
    
    A copy of the stub file cpprt0_stub.s can be shipped.
    ================ cpprt0_stub.s ===================
            .code
    ; stubs for static constructors in a.out
            .export __StaticCtorTable_Start,data
            .export __StaticCtorTable_End,data
    __StaticCtorTable_Start
    __StaticCtorTable_End
    
            .data
    ; stubs for static constructors in a.out, compiled with +z/+Z
            .export __ZStaticCtorTable_Start,data
            .export __ZStaticCtorTable_End,data
    __ZStaticCtorTable_Start
    __ZStaticCtorTable_End
    

In addition, your customers should review Mixing C++ with other Languages for information on linking HP aC++ modules with HP C, HP Pascal, and HP FORTRAN 77.

NOTE: HP aC++ code cannot be mixed with HP C++ code.

Installing your Application
HP aC++ releases are usually forward compatible, but HP cannot guarantee that this will be true for all releases. If you have questions about the compatibility of HP aC++ releases, you should contact your HP support representative.

Normally your customer will already have the correct runtime installed. If your product requires a newer version, it is recommended that the customer install the latest patch.

Your application’s installation procedure should install the appropriate HP aC++ components in the standard directories on your customer’s systems. This will ensure that the aCC command can find them.

Note: If your customer already has HP aC++ installed and their version is newer than yours, do not overwrite any of the existing HP aC++ components. Do not install your product on a system that has a newer version of HP aC++ if that newer version is incompatible with your version.

Ensure that your customer does not install a version of HP aC++ after installing your product; if that version of HP aC++ is incompatible with your version.

HP aC++ Files You May Distribute
You can package and redistribute the following HP aC++ components to your customers. The following HP aC++ runtime libraries are provided as a patch to the HP-UX core system:
  • /usr/lib/libCsup.so and libCsup_v2.sl
  • /usr/lib/libstd.so and libstd_v2.so
  • /usr/lib/librwtool.so and librwtool_v2.so
  • /usr/lib/libstream.so
  • The corresponding libraries in .../usr/lib/pa20_64/.

NOTE: Refer to the NOTE in the prior section Applications that use HP aC++ Shared Libraries.

Terms for Distribution of HP aC++ Files
Permission to distribute the above mentioned HP aC++ runtime shared libraries is based on the following terms and conditions:
  • These HP aC++ components cannot be redistributed as part of a C++ compiler, linker, or interpreter product.
  • All copyright notices in the code must be retained.
  • The HP aC++ executable components can only be redistributed by HP aC++ customers.