Questions tagged [webassembly]
WebAssembly (abbreviated Wasm) is a new portable, size- and load-time-efficient format suitable for compilation to the web.
2,854
questions
0
votes
0
answers
19
views
Can I use more than 2 cores for a Blazor Wasm AOT Publish Build in VS2022?
During my publish build, the CPU usage is 50%. The build takes about half an hour, so I wanted to test it with more cores. I tried dotnet publish --configuration Release --aot --runtime wasm --...
0
votes
0
answers
6
views
essentia.js inconsistent results detecting features in test audio files
I would like to detect features in audio files such as note positions and pitch. Essentia.js is a library which can do this. My code is:
const Essentia = require('essentia.js');
const fs = require('fs'...
0
votes
0
answers
62
views
How to return structs, Result, Option from Rust in WASM?
This question is based on this discussion.
I need to return different structures, Option, Result.
I noticed the externalref crate, but it is in experimental status and I can't use it.
I was trying to ...
0
votes
0
answers
38
views
How can I implement a rust constructor compiled to wasm that will allow for javascript destructuring? [duplicate]
I'm using rust-wasm, wasm-bindgen, to create a javascript wrapper for a rust library.
I have a rust constructor currently defined like
#[wasm_bindgen(js_class = Dater)]
impl DaterWrapper {
#[...
-1
votes
0
answers
76
views
How should I implement a rust constructor compiled to wasm that will allow for javascript destructuring?
I'm using rust-wasm, wasm-bindgen, to create a javascript wrapper for a rust library.
I have a rust constructor currently defined like
#[wasm_bindgen(js_class = Dater)]
impl DaterWrapper {
#[...
1
vote
0
answers
16
views
Ebiten wasm won't load
I'm trying to load Ebiten into Wasm using the command go run github.com/hajimehoshi/wasmserve@latest ., but when I go to try and load the localhost:8080 I just get an indefinite black screen. The ...
1
vote
1
answer
35
views
How can I compile Raylib to WASM in Golang?
I'm trying to compile Raylib to WASM in Golang, but when I run the command env GOOS=js GOARCH=wasm go build . Go can't seem to compile rcamera, and it gives me the following error message
# github.com/...
1
vote
1
answer
46
views
How can I capture stdout and stderr from a WebAssembly module generated by Emscripten in JavaScript?
I have the following C++ code
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
return 0;
}
Which I compile with
emcc -s ENVIRONMENT=shell -s ...
-4
votes
0
answers
17
views
How fast WebAssembly? [closed]
I want to do something like a chat. I already wrote in C reliable udp. But the chat needs to work in the browser. In my reliable udp there is a main loop with a call to poll(). My question is how many ...
1
vote
0
answers
24
views
How to cache compiled webassembly modules?
I am creating a CAD web app using OpenCascade.js a port of the OpenCascade CAD library to JavaScript and WebAssembly via Emscripten.
The wasm file is cached by browser but every time the page is ...
0
votes
0
answers
41
views
Is there a way to Optimizing Linear Memory Model in WebAssembly for Improved Memory Management?
We've been exploring challenges the flat memory model in WebAssembly, as highlighted in Empowering Web Applications with WebAssembly: Are We There Yet?: https://weihang-wang.github.io/papers/wasm-...
0
votes
0
answers
26
views
.pro file fails to read when switching to webassembly from desktop kit Qt Creator 6.6.0
I just configured Qt for WebAssembly, but whenever I switch the kit to webassembly it fails to read the .pro file, and despite my efforts I just can't figure out why.
[when I switch to webassembly kit]...
-1
votes
0
answers
24
views
Inject a function that executes without being called? [closed]
Is it possible to inject code into a form such that the code always executes?
The idea is:
@inject a function
When the page opens, the function executes to determine whether the injected service has a ...
0
votes
1
answer
35
views
go wasm impl simple await raise error "fatal error: all goroutines are asleep - deadlock!"
following is my code
package main
import (
"fmt"
"syscall/js"
)
func main() {
js.Global().Set("testMethInWasm", js.FuncOf(func(this js.Value, args []js....
0
votes
0
answers
17
views
How to impl go wasm promise await
here is my code
func Await(p js.Value) js.Value {
var r js.Value
var e string
done := make(chan struct{})
p.Call("then", js.FuncOf(func(this js.Value, args []js.Value) ...
0
votes
1
answer
38
views
How to run C++ code in WebAssembly and capture stdout?
Give this program em C++
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
How can I compile it to WebAssembly and capture ...
-5
votes
0
answers
55
views
How to run unsafe code in serverless environments [closed]
EDIT: The user will send an C or C++ code without any library dependency, it must compile with gcc (g++ main.cpp -o output), or to WebAssembly, and then I want to limit the execution time, disk access ...
0
votes
0
answers
11
views
Possible to collect data from a injectable service?
Scenario:
A blazor web assembly application that will manage, among other things, information about companies.
At login, I want the user to be able to select a "working company" and place it ...
1
vote
1
answer
52
views
Emscripten handover double array - Apparently random address is received
I have trouble handing over a double array to a WASM file, that is generated via emscripten. I have generated it as a .js output file with WASM=1, so I also have a wasm file.
This is my abbreviated C++...
0
votes
0
answers
42
views
wasm-bindgen CLI not working when trying to build
When I try to use wasm-pack build, it outputs the following (with RUST_BACKTRACE=full):
[INFO]: 🎯 Checking for the Wasm target...
[INFO]: 🌀 Compiling to Wasm...
Finished release [optimized] ...
0
votes
0
answers
33
views
Does WABT provide complete support for WebAssembly Garbage Collection (WasmGC)?
I can see that wat2wasm does have the option to enable "gc" but when running this example (with all features enabled):
(module
(type $Node (struct (field $next (ref null $Node)) (field $...
-1
votes
0
answers
49
views
Charge fuel for executing host functions
Our rust code(substrate executor in this case) currently calls into wasmtime::TypedFunc::call to execute some WASM code. And the WASM code calls back (via the host function/ABI) to access storage.
I ...
-2
votes
0
answers
41
views
Where are the downloaded WASM files in Blazor 8
When I create a .NET 8 Blazor Web App, with Global WebAssembly, and load the site from VS, I never see any DLLs or .wasm files downloaded. Even though it's configured for WebAssembly, the last line ...
1
vote
1
answer
37
views
How to call JavaScript function with params from ASP.NET Core 8 with JSImport interop?
Using a wasmbrowser project and ASP.NET Core 8 I can call .NET from Javascript with JSImport interop
Microsoft documentation includes this example without any params.
C#
[JSImport("window....
0
votes
0
answers
20
views
Force loading assemblies in webassembly project - MEF - AvaloniaUI
Problem:
When using MEF with webassembly the composition is not working.
My setup:
I have a AvaloniaUI project with ReactiveUI as MVVM Framework. To load modules I have added MEF.
I have multiple ...
3
votes
1
answer
116
views
What is `offset` in wasmtime Memory.read?
Problem
I've got wasmtime up-and-running, calling a TinyGo WASM/WASI module from a Rust host. All is well until I try to return a string from the Go WASI module, which seems like something everyone ...
0
votes
1
answer
62
views
How to understand the recursive types in Wasm?
How to understand the difference between the two snippets of code? The spec says that a rec definition defines a group of mutually recursive types that can refer to each other. But for the first ...
0
votes
1
answer
45
views
Is it possible to add a footer to a Mud Blazor DataGridComponent?
I am new to Mud Blazor, and use a DataGrid component to manage a database's content. I have a simple Add button which allows adding new entry to the datagrid. I have been browsing the specs and Google ...
0
votes
0
answers
34
views
custom opencv.js + wasm: Using cv.matFromArray() results in cv.Mat() is not a constructor. How to load the `module` correct in Typescript?
I followed this tutorial to create a custom opencv.js [1]: https://docs.opencv.org/4.x/d4/da1/tutorial_js_setup.html
But I'm stuck with the correct laoding in my Typescript project. The created script ...
0
votes
0
answers
12
views
Why is br_table in devtools different than the wast examples and how does it work?
I was looking at the br_table examples from the WebAssembly test suite but they don't look like the ones I'm seeing in devtools. For example, this is a random br_table I picked from wast (br_table 0 1 ...
0
votes
1
answer
59
views
Why do we need the type of i31 in WasmGC proposal?
Why do we need the type of i31 in the WasmGC proposal? The difference between it and primitive scalar is only the tagging bit, is that right? Also, I saw from the spec that an i31 is not actually ...
0
votes
0
answers
57
views
Operating on a JsValue in Rust/Leptos
I have a js file that returns an array of objects in the following format
[{id:0, name:"A"}, {id:1, name:"B"}, {id:2, name:"C"}]
I am using the Rust web framework Leptos ...
2
votes
0
answers
14
views
How to unsigned operations with negative values work in WebAssembly?
I'm looking at unsigned operations with negative parameters, and I don't know what it actually does.
For example, i32.div_u does some weird stuff. This comes out as 0
i32.const 2
i32.const -3
i32....
0
votes
0
answers
10
views
How does the instruction "atomic.fence" work on the code generated through LLVM "stackify pass"?
I am trying to find some example cases regarding the WebAssembly instruction atomic.fence, but what I only found on the Internet are the test cases in the LLVM implementation of this instruction, and ...
3
votes
2
answers
93
views
WebAssembly pre-fetch external resources and then use fopen on it
I have a C++ project that uses EMSDK to compile to WebAssembly. I have an asset that my project loads, a bundle.zip that I currently use the '--embed-file' flag from the SDK at compile time, and this ...
0
votes
1
answer
42
views
How to build a Nuget package with both an assembly and a JavaScript file?
I am trying to create a NuGet package that includes one assembly and one JavaScript file that I can use in a Blazor app. I am targeting .Net 6.0 since it is LTS and I will want to publish the final ...
0
votes
0
answers
42
views
Am I forced to use mirroring of entities by domain-driven design in WASM?
I'm working on Blazor with server side and WASM.
In DDD (Domain Driven Design), all entities are stored in domain layer (Core) project where services (all business logic) are placed, too.
But since ...
0
votes
0
answers
42
views
Golang "syscall/js" build constrains in project [duplicate]
I am working on a web browser multiplayer game in golang. The backend is in go, and the frontend is in go, compiled to wasm.
I am importing syscall/js in a bunch of my files in order to interact with ...
0
votes
1
answer
49
views
Is it possible to use C# code to call Firestore database in .NET Web Assembly project?
I have just set up a new .NET 8 Web Assembly project and want to interact with a Firestore database. So I downloaded the official .NET library (https://www.nuget.org/packages/Google.Cloud.Firestore/ ) ...
1
vote
1
answer
45
views
Why can't I use constant expressions in some Wasm instructions that require numeric literals?
Why can't I use constant expressions in some Wasm instructions that require numeric literals? Because it seems to me that they have the same effect, but constant expressions would be more flexible ...
-1
votes
0
answers
43
views
Run Docker Command from Javascript, that will excecute Infinite Storage Glitch i.e a rust file by DvorakDwarf
Infinite-Storage-glitch is a way of converting files into videos in form of binary static images, it is written in rust, but I wanna run it from javascript using childprocess as my frontend is ...
1
vote
1
answer
49
views
How would you convert f32.reinterpret_i32 and f64.promote_f32 to javascript?
I'm trying to convert this small bit of Webassembly to JavaScript, but I don't know how the commands f32.reinterpret_i32 and f64.promote_f32 would be written. Here is what I am trying to convert:
...
0
votes
0
answers
40
views
Is it possible to implement a UDP socket in Rust for the WebAssembly (WASM) and use it in a web browser? [duplicate]
I am currently working on implementing a UDP socket in Rust for a WebAssembly (WASM) environment within a web browser. I've tried to create the UDP socket using the provided Rust code, but I'm ...
-2
votes
0
answers
38
views
Why Chrome doesn't support creating a V128 global value with JavaScript API?
Why Chrome doesn't support creating a v128 global value with JavaScript API? Since the spec itself does support this.
You can try with below code in the Chrome console:
new WebAssembly.Global({ value: ...
1
vote
0
answers
59
views
Blazor WASM Project trying to embed PowerBI Report getting PlatformNotSupportedException error
I have Blazor .NET6.0 WASM Project and am trying to embed a Power BI report in it.
I tried using the below example provided for Blazor Server project
Embedding Power BI in Blazor.
When I try to ...
0
votes
1
answer
26
views
why do checkbox events give panic: ValueOf: invalid value
I have a very normal golang wasm setup. A wasm_exec.js from go 1.21.0 and everything is working great. I can call:
button.Set("onclick", js.FuncOf(MyClick))
and lots of other stuff. But ...
0
votes
1
answer
59
views
WebAssembly (Avalonia) Uncaught ManagedError: One or more errors occurred. (Cannot wait on monitors on this runtime.)
I've created my browser app with AvaloniaUI, and it has next code, called from App.axaml.cs:
using (var client = new HttpClient())
{
var task = Task.Run(() => client.GetStringAsync(_apiBaseUrl))...
0
votes
1
answer
67
views
Accessing Azure Maps JavaScript methods via Blazor WASM Maps Component
We have integrated the Azure Maps Control into our blazor WASM app using the following library, so that we can get the benefit of interacting with Maps via C#:
https://github.com/arnaudleclerc/...
0
votes
1
answer
78
views
Write rust app that allows sandboxed plugins written in .. rust? [closed]
I want to write an app in rust that is extensible with plugins written by (untrusted) users. Those plugins are downloadable via a web platform and can be installed by any user of the core software, ...
0
votes
1
answer
108
views
Can tokio::runtime be used in wasm?
everybody.
let rt = tokio::runtime::Runtime::new().unwrap();
This code doesn't work when I try to build wasm.
let rt = tokio::runtime::Runtime::new().unwrap();
| ^^^^^^...