-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/
Description
the following rust code is failing to compile using wasm32-unknown-emscripten target
extern {
#[link(name="env")]
fn log_event(id: *const u8);
}
fn main() {
unsafe { log_event(::std::ptr::null()); }
}
with
error: unresolved symbol: log_event
correct me if I'm wrong, I might be terrible wrong with this, but #[link]
without kind=static
implies dynamic linking, and the above code should not fail to compile?
As for emscripten itself, it has no problem compiling C code like this:
extern void log_event(void* ptr);
int main() {
log_event(0);
}
with emcc <source above.c> -O3 -s WASM=1 -s SIDE_MODULE=1 -o result.wasm
producing nice import entry in the result.wasm
(import "env" "_log_event" (func (;0;) (type 0)))
So, the question is, is there is any option to have dynamic symbols in the resulting wasm? Or at least override this linker ERROR_ON_UNDEFINED_SYMBOLS
argument at some point?
source link would be:
"ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()]); |
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/