> I have a 3rd party shared object (.so) file generated from gcc 3.x compiler > and i dont have sources for the same and I have upgraded my sources ( c++) to > newer compilers gcc 4.x which needs to be linking with 3rd party shared > object which is compiled by gcc 3.x > > Please let me know is there any way i link old shared objects with newer > compiler . > > $g++ hello.c -lmylib3.so -lmylib4.so > > here > g++ is 4,x > mylib3.so - created by gcc 3.x and > mylib4.so is created by gcc4.x
AFAIK, there hasn't been any change in the ELF format, so they should just work. You can confirm by running readelf/file and making sure the version, abi version are the same. $ readelf -h /lib/libc-2.11.so ELF Header: Magic: 7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00 *Class:* ELF32 *Data:* 2's complement, little endian *Version:* 1 (current) *OS/ABI:* UNIX - Linux *ABI Version:* 0 Type: DYN (Shared object file) *Machine:* Intel 80386 *Version:* 0x1 Entry point address: 0x173d10 Start of program headers: 52 (bytes into file) Start of section headers: 2399208 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 10 Size of section headers: 40 (bytes) Number of section headers: 76 Section header string table index: 75 $ file /lib/libc-2.11.so /lib/libc-2.11.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped -- 0 _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
