names. However, HP recommends an alternative method. The dynamic linker, during its attempt to load libraries, will suffix candidate directories with the machine type. The HP XC system on the CP4000 platform uses i686 for 32-bit binaries and x86_64 for 64-bit binaries. HP recommends structuring directories to reflect this behavior. Therefore, if your released directory structure has a form similar to Figure 4-1, then ensure that the LD_LIBRARY_PATH has /opt/mypackage/ lib in it, which will then be able to handle both 32-bit and 64-bit binaries that have linked against libmystuff.so.

Figure 4-1 Library Directory Structure

If you have an existing pattern using different names, HP recommends introducing links with the above names. An example of this is shown in Figure 4-2.

Figure 4-2 Recommended Library Directory Structure

Linking an application using the library (dynamic or archive) requires you to specify the appropriate subdirectory, depending on whether the application is 32-bit or 64-bit.

For example, to build a 32-bit application, you might enter:

<linkcommand> <32-bit> -L/opt/mypackage/lib/i686 -lmystuff

To build a 64-bit application, you might enter:

<linkcommand> <64-bit> -L/opt/mypackage/lib/x86_64 -lmystuff

4.8 Developing Libraries

47