Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
p.c
 
 

README


Compiling and running
---------------------
$ make && ./p

Output
------
cc -fPIC -Wall -pedantic   -c -o d1.o d1.c
cc -fPIC -Wall -pedantic   -c -o base1.o base1.c
gcc -shared \
		-Wl,--default-symver \
		-Wl,-soname,libbase.so.1 \
		-o libbase.so.1.0 base1.o
ldconfig -N -f ld.so.conf
ln -fs libbase.so.1 libbase.so  # library to link with
gcc -Wl,-rpath=. -L. \
		-Wl,--default-symver \
		-Wl,-soname,libd1.so \
		-shared -o libd1.so d1.o -lbase
rm libbase.so
cc -fPIC -Wall -pedantic   -c -o d2.o d2.c
cc -fPIC -Wall -pedantic   -c -o base2.o base2.c
gcc -shared \
		-Wl,--default-symver \
		-Wl,-soname,libbase.so.2 \
		-o libbase.so.2.0 base2.o
ldconfig -N -f ld.so.conf
ln -fs libbase.so.2 libbase.so  # library to link with
gcc -Wl,-rpath=. -L. \
		-Wl,--default-symver \
		-Wl,-soname,libd2.so \
		-shared -o libd2.so d2.o -lbase -ld1
rm libbase.so
cc -fPIC -Wall -pedantic   -c -o p.o p.c
cc -Wl,-rpath=. -o p p.o -L. -Wl,-rpath=. -ld1 -ld2
base version 2> init
base version 1> init
d1> init
d2> init
d1()
 d2_print()
  base version 2> d1
d2()
 d1_print()
  base version 1> d2
d2> fini
d1> fini
base version 1> fini
base version 2> fini

About

Example of a diamond linking thingy with version problems. See http://blog.habets.pp.se/2012/05/Shared-libraries-diamond-problem

Resources

Releases

No releases published

Packages

No packages published

Languages