c++ - Why do we need compiling and linking separately? -
is possible link @ time of compiling, , remove separate linking step?
you compile 1 or more translation units @ time, far language concerned each tu considered in isolation when compiling. link 1 or more translation units together.
so, if tus in program compiled @ same time, can link them @ time (well, linking after compilation, that's internal detail , there's nothing stop writing compiler/linker somehow interleaves steps there's no single point occurs after compilation has finished before linking starts).
however, if compile 1 tu out of many later linked make program, of course cannot link @ same time. link what? other tus might not have been written yet, if tu compiling distribution staticly-linked library.
Comments
Post a Comment