Skip to content

support to bind wasm #2658

Open
Open
@HerrCai0907

Description

@HerrCai0907

Feature suggestion

I think it will improve the software community ecology if we can support bind wasm which satisfies the requirement of linking. It means we can call c/c++(maybe other language based on LLVM like rust but I don't try it) function in assemblyscript.

How to implement in assemblyscript:

First step we can add a command line option to preload one wasm file and add it into Program instance and then compile wasm module.
Second step maybe statement like import * as xxx from "xxx.wasm" can be supported, but it needs more effort.

I wonder if this proposal meets the roadmap of the community and if this PR can be merged into main.

How to handle multiple memory manager:

Memory.grow in wasm should be checked and it will trigger a compile-time Error.
For c/cpp, most of code will alloc memory by malloc / free / realloc in libc, so it can be resolved by using custom libc. e.g. https://github.com/WebAssembly/wasi-sdk

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions