问题标签 [webassembly]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ubuntu - 尝试在 Ubuntu 16.04 上构建 emsdk 时出错
我正在尝试按照网络组装说明(http://webassembly.org/getting-started/developers-guide/)安装 emsdk。它在 OSX 上编译得很好,但是当我尝试在 Ubuntu 16.04 上构建它时遇到以下错误:
有谁知道发生了什么?
webassembly - 无法使用从 WebAssembly 模块导出的函数?
以下 JavaScript 代码引发错误myMathModule.exports is undefined
:
test.wasm
导出doubleExp
函数。
javascript - Mac OS X Sierra 上的 Emscripten SDK 错误
尝试在Mac OS X Sierra 版本 10.12.5上安装 Emscripten SDK
在Python 版本 3.6.2 和 2.7.13上都试过了
我在终端窗口中收到错误日志,如下所示:
Traceback(最近一次调用最后一次):文件“./emsdk”,第 35 行,如果 os.name == 'nt' or 'WINDOWS' in os.getenv('SYSTEMROOT') 或 'WINDOWS' in os.getenv( “COMSPEC”):TypeError:“NoneType”类型的参数不可迭代
非常感谢任何帮助或指示。
webassembly - 如何在 WebAssembly 中使用`indirect_call`?
没有使用indirect_call
available online 的示例。基于语义文档,我尝试了
数字是随机的,而不是像我预期的那样给出运行时错误。我收到解析错误。
什么是正确的语法call_indirect
?
memory - Getting an array in Javascript from Rust compiled to Emscripten
I want to generate a vector of bytes (Vec<u8>
in Rust) and access it with JS as an Array
or Uint8Array
and send it to a WebSocket or to IndexedDB.
I found How can I pass an array from JavaScript to Rust that has been compiled with Emscripten?, which is the exact opposite of what I would like to do, but very relevant. Other than that, I am aware of the array type in Emscripten, but I am not aware how to correctly use it.
My best guess on how to get this working was to try returning the vector as_mut_ptr
, and use the pointer on the Module.HEAPU8
.
main.rs
Part of index.html
The results of the console ended up looking like this:
The first issue is that both values represent empty arrays, and second the two separate calls are pointing to the same memory location. I have absolutely no idea how to access pointed to data on the heap, along with the length of the vector.
The two pointers pointing to the same memory location could be because Rust drops the Vec<u8>
write when it's lifetime ends, (end of the bytes
) function.
Sorry if I missed some basics of Wasm and Emscripten, I only built my first Wasm hello world today.
web-worker - 当我有两个网络工作来下载同一个文件时,如何减少一个下载时间?
在我的网络模块中,我有两个网络工作,一个用于解码音频,另一个用于编码音频。在每个网络工作中,我需要下载相同的 wasm 代码(现在,我不想拆分代码)。我想知道是否有一种方法我可以下载一次(如缓存),并且每个webwork都可以使用代码?
rust - rust、WebAssembly 和传递参数以增加总内存
我有一个 rust 项目,我正在根据http://asquera.de/blog/2017-04-10/the-path-to-rust-on-the-web/编译到 webasm
项目编译。当我在 Chrome Canary 中运行它时,它会耗尽内存并给我一个非常有用的错误消息:
问题是,不清楚如何将这些标志传递给 rustc / 构建工具链。
既不设置 EMMAKEN_CFLAGS 也不进行以下工作:
visual-studio-code - Vscode task & emscripten
I've created a custom task that compile my "C" files with emscripten, but the output files are saved at the root of my workspace. I would like to change this, so the compiled files are saved in the same directory as my input js file
My task.json file:
c - 如何将 OpenSSL 与 emscripten 链接?
我正在尝试编译一些将 OpenSSL 与 emscripten 一起使用的 C 代码,但我收到未解析的符号警告,例如:
我使用以下命令编译了代码:
使用以下源代码
javascript - 如何从 js 访问 WebAssembly 中的编译内存
考虑以下 C++ :
它将从 Clang/LLVM 编译为插入到下面操场中的 WASM 字节码。
WAST 可读性:
当从 js 调用时,MYVAR 将暴露一个指向变量的指针。
但是如何使用新的 js API 访问实际内存呢?
初始化时,内存构造函数似乎删除了该条目,但我不确定我是否正确解释了这一点。
作为旁注,模块没有规范中指定的导出属性,但这再次可能是一种误解。
操场: