This is only the record of the content of the book I read.
gcc -fPIC -c initapi.c
gcc -fPIC -c randapi.c
gcc -shared initapi.o randapi.o -o libmyrand.so
gcc main.c -L. -lmyrand -o main
export LD_LIBRARY_PATH=./
If we wanted to load this shared library dynamically.
cp libmyrand.so /usr/local/lib
沒有留言:
張貼留言