Creating your C library in linux gcc
In creating APIs, most of the time, you would like to hide what's being done underneath and would just like to let the users of your API to use the functions that you have written. Here is one way of creating your library.
1. Prepare your .o files. (you can create multiple .o files)
# gcc -g -O2 -O0 -g3 -c sample.c sample.o
2. Create an archive of your library.
# ar r libsample.a sample.o
3. Generate index to archive.
# ranlib libsample.a
4. To check functions of your library. (you can use nm - list symbols from object files)
# nm libsample.a
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment