[LCP]creation of a shared library from a static library.
sasidhar p
psasidhar at hotmail.com
Mon Nov 19 17:50:27 UTC 2001
Hi,
Can you create a shared library from a static library?
I am facing some problems, can you please spare some time for me?
1. I have 3 files a.c b.c and cli.c
2. i used the following steps
$ gcc -fPIC -g -c -Wall a.c
$ ar rcs libadd.a a.o
$ gcc -fPIC -g -c -Wall b.c
$ gcc -shared -Wl,-soname,libmystuff.so.1 -o libmystuff.so.1.0.1 libadd.a
b.o -lc
$ LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH
$ ln -s libmystuff.so.1.0.1 libmystuff.so
$ ls
a.c a.o b.c b.o cli.c libadd.a libmystuff.so libmystuff.so.1.0.1 myhdr.h
$ gcc -L . cli.c -lmystuff
This giving me the following error...
/tmp/ccbpNOID.o: In function `main':
/tmp/ccbpNOID.o(.text+0x1d): undefined reference to `add'
collect2: ld returned 1 exit status
'add' is defined in a.c that is the static library...
thanx,
Sasi.
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
More information about the linuxCprogramming
mailing list