Closed dtolnay closed 2 years ago
This is the intended way to make a crate force linkage of another crate. Also used in https://github.com/dtolnay/cxx/blob/1.0.78/src/lib.rs#L397-L398 for example to link the C++ standard library, as well as for all the various non-default sysroot crates, such as in https://github.com/dtolnay/syn/blob/1.0.102/tests/test_round_trip.rs#L7-L14.
The major advantage is you don't need to fool an optimizer into thinking that runtime control flow ever reaches the other crate.
This should have been obvious to me! Thanks. I put the wasm_opt_sys::init function back in, unused and filed https://github.com/brson/wasm-opt-rs/issues/97 to remove it when I do a major version bump.
wasm_opt_sys::init
This is the intended way to make a crate force linkage of another crate. Also used in https://github.com/dtolnay/cxx/blob/1.0.78/src/lib.rs#L397-L398 for example to link the C++ standard library, as well as for all the various non-default sysroot crates, such as in https://github.com/dtolnay/syn/blob/1.0.102/tests/test_round_trip.rs#L7-L14.
The major advantage is you don't need to fool an optimizer into thinking that runtime control flow ever reaches the other crate.