Skip to main content

All Questions

Tagged with
4 votes
1 answer
803 views

Attempting to compile with my own static C library

I compiled a static library. I have two files. mylib_1.c with function foo1 in it mylib_2.c with function foo2 in it. Both #include "mylib.h". I compiled a library like so: gcc -c mylib_1....
DEADBEEF's user avatar
  • 665
1 vote
1 answer
855 views

Extract multiple objects with the same name from a library

I have a .a file that contains a number of objects that share the same name (utils.o for example). How can I extract these objects when the ar utility only operates on the name?
OrangeDog's user avatar
  • 38.1k
1 vote
1 answer
307 views

How do I create a static library which automatically links to a dynamic library?

I maintain our in-house infrastructure library - lets call it libcluracan. This library has to be statically linked because it doesn't exist on outside computers where the code is used. This means ...
rabensky's user avatar
  • 2,904
12 votes
2 answers
7k views

Is using --start-group and --end-group when linking faster than creating a static library?

If one builds static libraries in one's build scripts and one wants to use those static libraries in linking the final executable, the order one mentions the .a files is important: g++ main.o hw.a ...
Johannes Schaub - litb's user avatar
12 votes
5 answers
4k views

`ar` library override timestamp

the .a archive format header requires a timestamp. This has led to countless headaches when I rebuild a static library, mainly because I can't exactly reproduce the original binary. For example (...
Foo Bah's user avatar
  • 26k
178 votes
6 answers
147k views

Linking static libraries to other static libraries

I have a small piece of code that depends on many static libraries (a_1-a_n). I'd like to package up that code in a static library and make it available to other people. My static library, lets call ...
Jason Sundram's user avatar