Changes between Version 2 and Version 3 of org/meetings/2018MexicoCity/Notes/RustLinking


Ignore:
Timestamp:
Sep 30, 2018, 8:25:22 PM (4 months ago)
Author:
teor
Comment:

Linking static vs dynamic

Legend:

Unmodified
Added
Removed
Modified
  • org/meetings/2018MexicoCity/Notes/RustLinking

    v2 v3  
    20205. The script reads the config.rust file and uses the variables in that list to configure the linker
    21216. The test-linking-hack feature in src/rust/protover/protover.rs defines an alternate version of a function that does not use a given C function. This resolves circular dependencies when linking C -> Rust -> C doctests. (Doctests don't use build.rs, don't set config(test), and don't set config(doctest).)
     22
     23== Static vs Dynamic Linking
     24
     25Rust's static linking takes all the .o files from the linked library and puts them in the Rust .a lib.
     26
     27Rust's dynamic linking defers the link step, and passes -L to the linker.
     28
     29Rust passed -nodefaultlibs to the compiler, so that all libs are explicitly included in the linker command-line. Nightly now has a -linker-default-libs argument that adds default libs.