2.8. Creating shared objects

This section explains how to create shared objects on AIX. Once shared objects are created, you can archive them into a library using the ar command (see 2.2.2, “Objects and libraries” on page 45).

In order to create a shared object, the following tasks are required:

Compile the source code files and create object files. Use the appropriate compiler driver to do so, for example, cc -c foo.c.
Create an export file to explicitly control exported symbols from the shared object, which you are going to create.
Re-link the created object file(s) to a shared object file. It is possible to combine multiple object files into a single shared object file. The following linker options are used in this step:
-bE:export_file ...

Get Developing and Porting C and C++ Applications on AIX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.