$ gcc -fPIC -c ctest1.c ctest2.c
$ ls
ctest1.c  ctest1.o  ctest2.c  ctest2.o  


$ gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 ctest1.o ctest2.o
$ls
ctest1.c  ctest1.o  ctest2.c  ctest2.o  libctest.so.1.0  prog  prog.c





$ readelf -h libctest.so.1.0 
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x3f0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          4396 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         7
  Size of section headers:           40 (bytes)
  Number of section headers:         27
  Section header string table index: 24
s



$ gcc -L. prog.c -lctest -o progd
















+ Recent posts