Skip to content

feat(rust) add native link option - #1685

Open
BjornTheProgrammer wants to merge 1 commit into
bytecodealliance:mainfrom
BjornTheProgrammer:wit-native
Open

feat(rust) add native link option#1685
BjornTheProgrammer wants to merge 1 commit into
bytecodealliance:mainfrom
BjornTheProgrammer:wit-native

Conversation

@BjornTheProgrammer

Copy link
Copy Markdown

Addresses bytecodealliance/wit-bindgen#1062. Currently the Rust bindings stub with unreachable!() when compiling to wasm. This PR makes bindings usable on native targets, so people can test and run component code in ordinary native environments.

This is a new approach to what was initially done in #1565.

The reason this PR needs to exist is described by a comment in the original PR

This PR despite making the possible stubs very modular, suffers from a lot of issues, I'm going to close this in favor of another PR that I've been making. The idea is a bit different, and slightly more complex then just calling a host function, since that would require the host binary to be compiled with "-rdynamic" on linux, and it wouldn't even work on Windows and MacOS.

To solve this issue I've added a register function which can add a pointer to the host function. This fixes the above issue.

Testing

  • Codegen tests have been added.
  • End-to-end validation via native-wit hosting native plugins in Pumpkin.

The Pumpkin PR is interesting because the approach shows how one can make very minimal changes and get wasmtime and native runtimes working at the same time.

@alexcrichton

Copy link
Copy Markdown
Member

Could you address the question I had in the other PR? This seems like a lot to take on in terms of maintainership here because only codegen is tested, not any runtime parts, and since that comment the component model has continued to add features like async which I'm not sure how would map to native counterparts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants