Improve documentation around link_this_library (#471)

I've started noticing this in non-LTO builds and initially tried to remove it. I
was unsuccessful but decided to better document my adventures to hopefully
improve future onlookers!
This commit is contained in:
Alex Crichton
2018-07-14 11:04:47 -05:00
committed by GitHub
parent e49e02cc88
commit d7a05129ac
3 changed files with 62 additions and 6 deletions

View File

@ -452,7 +452,8 @@ impl ToTokens for ast::Export {
#[allow(non_snake_case)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
pub extern fn #generated_name(#(#args),*) #ret_ty {
::wasm_bindgen::__rt::link_this_library();
// See definition of `link_mem_intrinsics` for what this is doing
::wasm_bindgen::__rt::link_mem_intrinsics();
let #ret = {
let mut __stack = unsafe {
::wasm_bindgen::convert::GlobalStack::new()
@ -794,7 +795,8 @@ impl ToTokens for ast::ImportFunction {
#[allow(bad_style)]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
#vis fn #rust_name(#me #(#arguments),*) #ret {
::wasm_bindgen::__rt::link_this_library();
// See definition of `link_mem_intrinsics` for what this is doing
::wasm_bindgen::__rt::link_mem_intrinsics();
#[wasm_import_module = "__wbindgen_placeholder__"]
extern {
fn #import_name(#(#abi_arguments),*) -> #abi_ret;