Skip to content

Linking JS files from libraries #38492

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
chpio opened this issue Dec 20, 2016 · 2 comments
Closed

Linking JS files from libraries #38492

chpio opened this issue Dec 20, 2016 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-asmjs Target: asm.js - http://asmjs.org/ O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!

Comments

@chpio
Copy link
Contributor

chpio commented Dec 20, 2016

hi,

it seems that it's not possible to link javascript files from a rust library at the moment. The usual practice is by setting the --js-library $path_to_js_file emcc-linker argument. But setting linker arguments from a lib is not allowed in rust (#36176, rust-lang/cargo#1293).

I can think of two possible solutions for this:

  1. allowing link args when compiling to asm.js/wasm
  2. using the extern-linking syntax and converting the link to an --js-library emcc argument to pull in the js file:
#[link(name="my_js_file")]
extern {
    fn add(a: size_t, b: size_t) -> size_t;
}
@badboy
Copy link
Member

badboy commented May 15, 2017

Can we get a A-asmjs tag here?

@Mark-Simulacrum Mark-Simulacrum added the O-asmjs Target: asm.js - http://asmjs.org/ label May 15, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 26, 2017
@chpio
Copy link
Contributor Author

chpio commented Jun 28, 2018

I'm closing this in favor of stdweb's inline js and wasm imports.

@chpio chpio closed this as completed Jun 28, 2018
@workingjubilee workingjubilee added the O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! label Oct 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. O-asmjs Target: asm.js - http://asmjs.org/ O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!
Projects
None yet
Development

No branches or pull requests

4 participants