Difference between -h <name> and -o <outputfile> parameters in cc (C ++)
3 answers
-o is the name of the file that will be written to disk by the compiler
-h is the name that will be written to the ELF binaries that reference this file.
One common use case is to provide minor library version numbers. For example, if you create a shared libfoo library, you can:
cc -o libfoo.so.1.0 -h libfoo.so.1 *.o
ln -s libfoo.so.1.0 libfoo.so.1
ln -s libfoo.so libfoo.so.1
, hello world
cc -o hello -lfoo
hello NEEDED libfoo.so.1 (
. elfdump -d hello).
, , -o
libfoo.so.1.1, -h libfoo.so.1 - ,
1.0 libfoo.so.1 , ,
, ls, 1.1.
, , . , , , , , Makefiles :
cc -o libfoo.so.1.new -h libfoo.so.1 *.o
rm libfoo.so.1 ; mv libfoo.so.1.new libfoo.so.1
(Makefile, makefile Imake X, .)
+5
-o , -h . .
, :
elfdump -d xxx.so | grep SONAME
. :
http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter4-97194.html
+1