Author Topic: Use of a Static Library  (Read 1532 times)

Offline jonjonzz

  • Single posting newcomer
  • *
  • Posts: 3
Use of a Static Library
« on: May 20, 2014, 02:46:53 pm »

I want to use a static library with some utilities from my own.
I opened a project "Utils" for that.
A file "main.c" was automatically created.
I inserted all my functions in the file "main.c" and compiled the file without any problem.
The library libUtils.a was created.
From the command line I started the commands:
$ ar t libUtils.a
And I got the answer: main.o
$ nm main.o
And I got all entry points to my functions.

The question is:
How later can I add other functions to this library ?
One answer could be to insert the new functions in the "main.c" file and recompile.
But what is the usefulness of a library with only one ".o" file ?
But another solution should be to compile separetely the new functions in another ".o" file, and to add this file to the libUtils.a library via the command ar -r libUtils.a "*.o"
How can I do that with the CB GUI ?