Hello again! :)

Okay, well, I thought I was going to go back to my homework and forget 
about this, but of course I had to look up how to make a static library 
for our friend Darius here :)

All right, what you want to do is compile each .c that you want in the 
library into an object file, .o

You might do something like:

% foreach i (*.c)
>  gcc -c $i
> end

or with Bash:

$ for i in *.c
> do
>  gcc -c $i
> done

to get all those .o files...

Okay, so now you make a static library from the .o files like this:

$ ar r mylib.a file1.o file2.o file3.o
$ ranlib mylib.a

And now you've got a static library to use!

$ gcc app.c mylib.a -o app

You can delete an object file from your library with ar like this:

$ ar d mylib.a badone.o

Does that help... ? I hope so :)

Have fun!

-Brett

Reply via email to