3 ms·
Nice series! One comment though: > The compiler ingests one .c and outputs one .o. It has a low memory footprint. The linker on the other side, must use all t
by _trackno5 3y ago
Nice series!
One comment though:
> The compiler ingests one .c and outputs one .o. It has a low memory footprint. The linker on the other side, must use all the .o files at once to generate the executable. Keeping all these .o in memory would stress the system too much on big projects.
This is a really weak argument that does not make a lot of sense.
The major advantage of separate object files is avoiding recompilation of modules that haven’t changed.
In fact, compilers like Jonathan Blow’s Jai seem to get massive performance improvements by treating everything as a single compilation unit and avoiding writing a bunch of object files only to call the linker on all of them.
- masfuerte 3y agoIt's probably the main reason historically that compiling and linking are separate steps. Back in the day, you might not have had enough memory to even load all of the source at the same time. But yeah, that was decades ago.