Saturday, May 09, 2009

Build library

http://changhoward.blogspot.com/2009/02/using-gcc-to-create-static-and-shared.html


Static:


$ gcc -c hello.c world.c /* 編出 hello.o 與 world.o */
$ ar rcs libmylib.a hello.o world.o /* 包成 limylib.a */

Shared:
$ gcc -c -fPIC hello.c world.c
$ gcc -shared -Wl,-soname,libmylib.so.1 -o libmylib.so.1.0.0 hello.o world.o

No comments:

Related Posts Plugin for WordPress, Blogger...