I did not find any correct information if and why I need ranlib / ar -s for static binding.
Suppose I have an application consisting of several modules. Each module has its own code files in its own folder, and object files are created in their own folder: module1/%.c → bin/module1/%.o For each module, I create a .a file: ar -rc bin/module1.a bin/module1/….o . The whole program is compiled using gcc bin/module1.a … moduleN.a -o bin/app .
In this scenario, what creates an index for the .a do file ? Compilation and the program work fine even if I don't add indexes to the .a files. But every example I found called ranlib after the last object file was added to the archive.
The question is not Linux / Mac / Windows.
source share