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:

1.
Compile the source code files and create object files. Use the appropriate compiler driver to do so, for example, cc -c foo.c.
2.
Create an export file to explicitly control exported symbols from the shared object, which you are going to create.
3.
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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.