Skip to content

Linking JS files from libraries #38492

Closed
Closed
@chpio

Description

@chpio

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.O-asmjsTarget: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions