What does the GCC static library contain?

My application links are against libsamplerate.a. I do this to facilitate the distribution of the final binary version.

I'm worried that maybe the code inside the .a file depends on some other libraries that I will need to distribute as well.

But if this does not bother me, I inflate my application too much, including several copies, for example. Libc.

What exactly will be inside libsamplerate.a? Just libsamperate bytecode? Or more?

+7
c ++ gcc static-libraries
source share
3 answers

A static library is just a collection of object files. When you compile a program against a static library, the object code for the functions used by your program is copied from the library into your executable file. Linking to a static library will not include any functions outside this library in your code.

+5
source share

An Aa file is basically a collection of .o files. This can be demonstrated using the ar tool.

For example, to display the contents of your library:

 ar -t libsamplerate.a 

To create a .a file from scratch:

 ar -r tim.a *.txt 
+6
source share

Just object code for libsamplerate. Static linking to one library does not cause all libraries to be linked statically; that would be bad.

+1
source share

All Articles