How do I make my own shared library?

How do I make my own shared library?

To make your own shared object or library of shared objects, you should
know that a shared object cannot have undefined symbols. Thus, if your
code uses any externals from /lib/libc.a, the latter MUST be linked with
your code to make a shared object. Mike Heath (mike@pencom.com) said it
is possible to split code into more than one shared object when externals
in one object refer to another one. You must be very good at
import/export files. Perhaps he or someone can provide an example.

Assume you have one file, sub1.c, containing a routine with no external
references, and another one, sub2.c, calling stuff in /lib/libc.a. You
will also need two export files, sub1.exp, sub2.exp. Read the example
below together with the examples on the ld man page.



Home FAQ