-
-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Import extern wast #194
Comments
At this point, what you could do is declare namespace env {
export function some_function_in_c(); void;
} Of course you could also use two WASM modules, with one of them being an import of the other one, using the same technique, but without linking them statically to a single binary. |
Could you expand upon this a little bit? In particular the "without linking them statically to a single binary" part, since it seems like that's what you're recommending with |
What I meant was to use the exports of one of the modules as the imports of the other module. For example, if you have two modules var foo = new WebAssembly.Instance(fooModule, {});
var bar = new WebAssembly.Instance(barModule, { foo: foo.exports }); While declaring the structure of declare namespace foo {
...
} |
Got it, that makes sense, but I think that means it needs to be run in the browser/in a JS environment which we're not doing with Ewasm. Thanks! It looks like my only options here are some form of static linking using |
How hard would it be to add support for some form of "inline Wast" within AS? |
There is some form already, but it doesn't cover everything yet and might need other improvements. In general, if Binaryen had an API to compile only an expression and integrate it into the IR, that'd also allow us to do something like: function myFunc(): i32 {
return <i32>`(i32.const 1)`!;
} That's of course just a very basic example to get the idea, here misusing the |
Another option would be to support something like a |
wasm-merge was deleted from binaryen recently, fyi WebAssembly/binaryen#2174 |
Closing this issue as part of 2020 vacuum because it has been lingering for quite a while and it seems unlikely that it will be picked up any time soon due to missing support on the Binaryen side. If this is important to someone who is interested in making this work, I suggest adding the relevant mechanism to Binaryen first, and once that's there open a new issue here. |
Hello,
I'd like to be able to link against a function defined in another module -- either the
wast
or a precompiledwasm
binary. Is this possible today? (If it's not possible at compile time I suppose I'd have to wait for dynamic linking to become possible per #84.)Thanks
The text was updated successfully, but these errors were encountered: