您的位置:首页 > 运维架构 > Linux

Linux learning jottings(2)-static or dynamic library

2016-04-02 16:03 567 查看

function library is divided into static library and dynamic library.

0x00. static function library

it was compiled into target file, so, its not needed at runtime.

Obviously, when the static library modified, you should recompile the application.

for example:

# Makefile
hello: main.c libhello.a
gcc -o hello main.c -L. -lhello
libhello.a: hello.o
ar cr libhello.a hello.o
hello.o: hello.c
gcc -c hello.c


libhello.a removed or not does not make any difference on the running of "hello"

0x01. dynamic function library

create dynamic function library

gcc -shared -fPCI -o libhello.so hello.o

0x02.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: