Skip to content

Conversation

@alexcrichton
Copy link
Member

This series of commits builds on #11880 in the same manner to build out the C++ API for components. The general design of the API is effectively the same as that for core wasm and reflects the functionailty of components currently in the C API. Component support at this time is not overly comprehensive but there's enough to instantiate and work with components.

This PR is split into a series of commits where each commit individually should pass all tests. They're logically all part of adding C++ support for components, however, and the end goal was to effectively rewrite all the C tests into C++ which is accomplished in this PR.

Just a bare-bones API for now with functionality that's possible to fill
out. Notably instantiation and defining functions is not yet possible in
C++. Some more feature-parity is also added with the core linkers as
well.
Upon reflection I realize that this is not actually necessary and is
otherwise a duplicate of the functionality in `wasi.h`. All of the
functionality in `wasi.h` is already supported to power WASIp2-defined
APIs in a linker, which is enabled by the `WasiView` trait redirecting
to the `WasiView for WasiP1Ctx` implementation. This is similar to how
the `wasmtime` CLI works where a P1 context is always created and then
it's conditionally used for either core wasm or components.

Effectively this is a deletion of duplicate functionality in the C API
but no underlying functionality is lost. Translating information to
preexisting WASI calls will work the same as using the wasip2 APIs before.
All the pieces are now in place to use the C++ API in testing.
@alexcrichton alexcrichton requested a review from a team as a code owner October 20, 2025 17:12
@alexcrichton alexcrichton requested review from pchickey and removed request for a team October 20, 2025 17:12
Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know C++ well enough to give this a useful review, but I'll rubber-stamp it

@alexcrichton alexcrichton added this pull request to the merge queue Oct 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 20, 2025
@github-actions github-actions bot added the wasmtime:c-api Issues pertaining to the C API. label Oct 21, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Oct 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 21, 2025
@alexcrichton alexcrichton added this pull request to the merge queue Oct 21, 2025
Merged via the queue into bytecodealliance:main with commit cde2e04 Oct 21, 2025
49 checks passed
@alexcrichton alexcrichton deleted the more-cpp-component-apis branch October 21, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:c-api Issues pertaining to the C API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants