Linker and modules

Does the compiler compile each module into an object file and then link them to a large object file? Or is the linker(msvc linker(windows)) not involved in the process of combining modules?

Rust uses the entire crate as its unit of compilation, so modules within a crate get combined by rustc. The linker is then invoked to combine all of a project's compiled crates into a single binary deliverable.

2 Likes

Thank you, I didn't know that!!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.