3 ms·
Yea, generating many object files seems like weird thing. Maybe it was good thing decades ago, but now? Because then you need to link them, thus you need some
by tester756 1y ago
Yea, generating many object files seems like weird thing. Maybe it was good thing decades ago, but now?
Because then you need to link them, thus you need some kind of linker.
Just generate one output file and skip the linker
- WalterBright 1y agoI've considered many times doing just that.
- tester756 1y agoAnd what was the result/conclusion of such considerations?
- WalterBright 1y agoNot worth the effort. 1. linkers have increased enormously in complexity 2. little commonality between linkers for different platforms 3. compatibility with the standalone linkers 4. trying to keep up with constant enhancement of existing linkers
- yencabulator 1y agoNot maybe. Sufficient RAM for compilation was a serious issue back in the day.
- kazinator 1y agoSure, and if any file is touched, just process them all.
- adrian_b 1y agoSome compilers had incremental compilation to handle this during development builds. Then only the functions touched inside some file would be recompiled, not the remainder of the file or other files. Obviously, choosing incremental compilation inhibited some optimizations.
- adrian_b 1y agoGenerating many object files is pointless for building an executable or a dynamic library, but it remains the desired behavior for building a static library. Many software projects that must generate multiple executables are better structured as a static library plus one source file with the "main" function for each executable.
- WalterBright 1y agoOne thing the D compiler does is it can generate a library in one step (no need to use the librarian). Give a bunch of source files and object files on the command line, specify a library as the output, and boom! library created directly (compiling the source files, and adding the object files). I haven't used a librarian program for maybe a decade.