shared library

suppose there are three class :A,B,C      C use A and B

let these class be shared library, A and B in a shared library,C in a shared library;

g++ -fPIC -c A.cpp -o A.o

g++ -fPIC -c B.cpp -o B.o

g++ -shared A.o B.o -o libAB.so

g++ -fPIC -shared C.cpp -o libC.so -L/path/of/libAB.so -lAB

你可能感兴趣的:(shared library)