> Dynamic libraries are a bit more involved.
>
> First, all source files need to be compiled with the -fPIC switch to
> create position-independant (relocatable) code.
>
> Then, to create the shared library itself, use e.g.
>
> gcc -shared -o libfoo.so.1.2 -Wl,-soname,libfoo.so.1 file1.o
file2.o ...
>
> The `-Wl,-soname,libfoo.so.1' sets the library's `soname' to
> libfoo.so.1.
Apologies, i am using latest solaris (sunos 5.6) and gcc 2.7 but i thought
i'd try this list since its usually so helpful (no solaris equivalent).
from the man page there is no -soname option.
I have a library consisting of a single header file and a corresponding
source file: libcvg.h, libcvg.c
i build the library as follows:
gcc -Wall -ansi -pedantic -g -fPIC -O3 -c libcvg.c
gcc -shared -o libcvg.so.1.0 -Wl,-soname,libcvg.so.1 libcvg.o
with the following errors:
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file libcvg.so.1: open failed: No such file or directory
ld: fatal: File processing errors. No output written to libcvg.so.1.0
the first warning appears to come from having -shared and -o
=> if i remove -o, the first warning goes away
i've tried many different arrangements of the above compiles, to no avail.
It didn't work under linux either (RH5.0, some updated RPMs) same errors
but it didn't complain about the -o option.
Thanx in advance,
Novak.