Comments (5)
The code you linked to is generated by emscripten. I guess for dart you have to do it manually. The only problem is I have no idea what the functions in the wasm module are as the names are obfuscated. Thanks for the pointers tho!
from wasm.
a::a(int32, int32, int32, int32)
is a function import, so you need to bind a Dart function to it in the WasmInstanceBuilder
(the thing that the builder()
function returns).
When you run it in JS, where is emscripten getting that function from?
from wasm.
I am not very familiar with wasm and emscripten.. The project (trust wallet core) that im compiling to wasm exposes functions through a C interface and has a set of .proto files. Is there a way to automatically bind generated dart protobuf code with the wasm module? It seems the javascript project does that.
"use strict";
// Copyright © 2017-2022 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
Object.defineProperty(exports, "__esModule", { value: true });
exports.WalletCore = exports.TW = void 0;
var core_proto_1 = require("./generated/core_proto");
Object.defineProperty(exports, "TW", { enumerable: true, get: function () { return core_proto_1.TW; } });
var WalletCore = require("./lib/wallet-core"); //! .wasm file and js glue code
exports.WalletCore = WalletCore;
Edit: React JS example that uses the javascript project
from wasm.
I'm guessing it binds those function imports somewhere in this file. You need to provide those function imports, like this:
walletCoreWasm = mod.builder()
..addFunction('a', 'a', (int arg1, int arg2, int arg3, int arg4) {
// Call your functions, eg the generated dart protobuf code.
}))
.build();
There's no way of automatically binding those functions.
from wasm.
@hnord-vdx Did you find a way to use Wallet core in Flutter web?
from wasm.
Related Issues (20)
- flaky macos CI HOT 2
- Slow CI HOT 1
- Wasmer async module compilation.
- Investigate generating bindings. HOT 2
- [ux] WASI
- [bindgen] functions starting with an underscore HOT 1
- Example projects are not easy to run HOT 2
- No JIT on iOS HOT 1
- Dart bindings via javascript transpilation/execution.
- iOS support has some problems HOT 1
- run Wasm-wasm_demo in android studio. show. this error "NDK not install"
- intent to discontinue HOT 7
- Windows dart run wasm:setup fail HOT 1
- WasmError: This case is not (yet) supported. Please file an issue on pkg:wasm HOT 7
- Show wasm stack trace in exception thrown from wasm trap handler
- GitHub CI crash HOT 1
- Provide an explicit public API and hide internals from users. HOT 1
- NativeFinalizer HOT 7
- Multiprocessing use case. HOT 5
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.