Comments (6)
Aha thanks for the hint @s3bk! Also thanks for the source @Marwes!
I've confirmed that the imports in @Marwes's wasm module are:
(import "env" "Math_acos" (func (;0;) (type 9)))
(import "env" "Math_atan" (func (;1;) (type 9)))
(import "env" "Math_atan2" (func (;2;) (type 11)))
(import "env" "Math_cbrt" (func (;3;) (type 9)))
(import "env" "Math_cosh" (func (;4;) (type 9)))
(import "env" "Math_expm1" (func (;5;) (type 9)))
(import "env" "Math_hypot" (func (;6;) (type 11)))
(import "env" "Math_log1p" (func (;7;) (type 9)))
(import "env" "Math_sinh" (func (;8;) (type 9)))
(import "env" "Math_tan" (func (;9;) (type 9)))
(import "env" "Math_tanh" (func (;10;) (type 9)))
(import "env" "__wbindgen_throw" (func (;11;) (type 3)))
(import "env" "cos" (func (;12;) (type 9)))
(import "env" "exp" (func (;13;) (type 9)))
(import "env" "exp2" (func (;14;) (type 9)))
(import "env" "fma" (func (;15;) (type 14)))
(import "env" "log" (func (;16;) (type 9)))
(import "env" "log10" (func (;17;) (type 9)))
(import "env" "log2" (func (;18;) (type 9)))
(import "env" "pow" (func (;19;) (type 11)))
(import "env" "round" (func (;20;) (type 9)))
(import "env" "sin" (func (;21;) (type 9)))
which is certainly something wasm-bindgen could handle! Ideally it wouldn't need to but I see no harm in fixing this for now.
from wasm-bindgen.
Thanks for the report! Is this perhaps due to a wasm-bindgen unknown import? Currently the wasm2es6js
tool assumes that the wasm input module is supposed to be interpreted as an ES6 module, but most wasm files produced by rustc right now aren't as there's not module named env
.
Would this perhaps be shareable?
from wasm-bindgen.
The error itself should be reproducible from this branch https://github.com/Marwes/try_gluon/tree/wasm, just run wasm.sh
(and make sure that https://github.com/ssuman/parcel-plugin-elm is installed.)
from wasm-bindgen.
I have seen it with mathematical functions. It can be solved by adding env
to the import:
const importObject = {
"./bullet_wasm": {
__wbindgen_throw: function(ptr, len) {
throw new Error(getStringFromWasm(ptr, len));
}
},
"env": {
cos: Math.cos,
sin: Math.sin,
exp: Math.exp,
log: Math.log
}
}
from wasm-bindgen.
Installed alexcrichton@d66bc25 and I now get the WASM running! Running it results in an index out of bounds exception however so I am trying to get source maps working to find out why that is.
EDIT: Source maps working, seems to be a index out of bounds when freeing memory :/.
from wasm-bindgen.
Hey @Marwes how did you get the source maps working?
from wasm-bindgen.
Related Issues (20)
- Unable to resolve version issue HOT 5
- Weak references fails to automatic garbage collect HOT 4
- Schema Version Mismatch Error when Using `cargo leptos watch` in WSL Ubuntu Environment
- export names as they are
- Generated binary crashes with "RuntimeError: memory access out of bounds"
- getter macro inconsistent behavior in Release/Debug builds HOT 3
- Uncaught TypeError: Cannot read properties of undefined (reading 'length')
- After extending web_sys with an IDL, when running` cargo doc --all-features --open` I get an erroneous can't find type error
- Automatic deallocation by `FinalizationRegistry` does not work for fully synchronous code HOT 4
- wasm-bindgen is broken and untested at MSRV (1.57) HOT 1
- Missing WebIDL processing features overview HOT 3
- wasm-audio-worklet example gives tons of warnings and some errors
- Expose synchronous XMLHttpRequest HOT 2
- Exports with `#[wasm_bindgen(js_name = default)]` gets exported as `fn _default`
- Trait-based Web API bidnings HOT 2
- `new` constructors for WebIDL bindings introduce undefined behavior by not setting default values HOT 2
- Splitting into multiple lazily-loaded modules HOT 17
- Could I send an option with Element to js function? HOT 2
- `wasm-bindgen` 0.2.92 triggers `clippy::mem_forget` HOT 2
- `wasm-bindgen` appears to trigger new `clippy` lint `clippy::empty_docs` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm-bindgen.