-
Notifications
You must be signed in to change notification settings - Fork 1.5k
c-api: Bring wasmtime-cpp into this repository #10582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c-api: Bring wasmtime-cpp into this repository #10582
Conversation
`wasmtime-cpp/include/wasmtime.hh` -> `/crates/c-api/include/` `wasmtime-cpp/tests/*` -> `/crates/c-api/tests/` `wasmtime-cpp/examples/*` -> `/examples/` See discussion in bytecodealliance#10566 for more context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! This looks pretty good to me, but I'd also want to test some more integration-y things before landing. To that end can you try a few things:
- Add a commit to this PR with "prtest:full" somewhere in the commit message so we can see the full CI run
- With a full run I want to double-check that the header file is present in the installation artifacts
- Mind updating
crates/c-api/README.md
with a mention that the C++ API is present as well? I can also do this as a follow-up if you'd prefer. - With a full run I want to double-check that the docs here are present in the c-api docs.
Also, after merging, I'll take on the bits of archiving the old repo. |
CI doesn't seem to have C++ compiler? Should a C++ compiler be a requirement, even when we don't build any C++ code? |
Could this be updated to only require a C++ compiler for tests? For a normal build it shouldn't be required I think? |
Ok nice looks like everything's integrated well, I can see the C++ tests running and I see |
This requires disabling warnings on undocumented, as `wasm.hh` has undocumeted structures Also fix urls in `wasmtime.hh`
Would it be preferred to only silence the undocumented warnings from |
If possible, yeah, although I'm not sure if it's easy to configure doxygen as such. |
I was thinking of |
Excluding in this case I think may actually be ok because while it works I think we'll still want to steer users towards |
This required excluding `wasm.hh`, `wasmtime::detail` namespace, and some macros. Also documented two overloads to `Func::call()`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice docs are looking great. Thank you again for working on this!
With the merging of the C++ API into this repository in bytecodealliance#10582 it opens up some interesting questions about how to organize the C++ API. Externally it was all entirely a single file, but naturally this isn't great for evolution as it's just one giant tangled header. Instead this commit sketches out a possible different path forward which is to provide the C++ API as a sibling to the C API in preexisting header files. For example this moves the `Error` class to the `error.h` header file as an example. My rough hope would be that in the long-term we could deprecate/remove the `wasmtime.hh` header file and instead "just" have all the C++ APIs in the normal header files (e.g. `wasmtime.h`). Additionally the split of the C API in separate header files would be amenable to a similar split of the C++ API too where the API you see is basically conditional on the language mode of whatever's including the headers. I'll note though I've not seen prior art in doing this. I'm not aware of any other project which exports both a C and C++ API in its header files. That being said I'm not sure how many other projects would fall in such a bucket.
With the merging of the C++ API into this repository in bytecodealliance#10582 it opens up some interesting questions about how to organize the C++ API. Externally it was all entirely a single file, but naturally this isn't great for evolution as it's just one giant tangled header. Instead this commit sketches out a possible different path forward which is to provide the C++ API as a sibling to the C API in preexisting header files. For example this moves the `Error` class to the `error.h` header file as an example. My rough hope would be that in the long-term we could deprecate/remove the `wasmtime.hh` header file and instead "just" have all the C++ APIs in the normal header files (e.g. `wasmtime.h`). Additionally the split of the C API in separate header files would be amenable to a similar split of the C++ API too where the API you see is basically conditional on the language mode of whatever's including the headers. I'll note though I've not seen prior art in doing this. I'm not aware of any other project which exports both a C and C++ API in its header files. That being said I'm not sure how many other projects would fall in such a bucket.
* Sketch out merging the C/C++ APIs With the merging of the C++ API into this repository in #10582 it opens up some interesting questions about how to organize the C++ API. Externally it was all entirely a single file, but naturally this isn't great for evolution as it's just one giant tangled header. Instead this commit sketches out a possible different path forward which is to provide the C++ API as a sibling to the C API in preexisting header files. For example this moves the `Error` class to the `error.h` header file as an example. My rough hope would be that in the long-term we could deprecate/remove the `wasmtime.hh` header file and instead "just" have all the C++ APIs in the normal header files (e.g. `wasmtime.h`). Additionally the split of the C API in separate header files would be amenable to a similar split of the C++ API too where the API you see is basically conditional on the language mode of whatever's including the headers. I'll note though I've not seen prior art in doing this. I'm not aware of any other project which exports both a C and C++ API in its header files. That being said I'm not sure how many other projects would fall in such a bucket. * Split out `error.hh` to its own file
No breaking changes in C-Api. All tests pass. Note that this release adds the C++ header files from wasmtime-cpp and split large header files into smaller files, so a lot of files have been added and changes to the c-api directory in wasmtime. However, there are no breaking changes to the c-api itself. bytecodealliance/wasmtime#10582
No breaking changes in C-Api. All tests pass. Note that this release adds the C++ header files from wasmtime-cpp and split large header files into smaller files, so a lot of files have been added and changes to the c-api directory in wasmtime. However, there are no breaking changes to the c-api itself. bytecodealliance/wasmtime#10582
See discussion in #10566 for more context.
Folloving files have been moved without edits:
wasmtime-cpp/include/wasmtime.hh
->/crates/c-api/include/
wasmtime-cpp/tests/*
->/crates/c-api/tests/
wasmtime-cpp/examples/*
->/examples/
The CMakeLists.txt content is copied to
/crates/c-api/CMakeLists.txt
with slight adjustments. I haven't fully gone through and checked if everything from the old CMake file still makes sense.The tests inside
/crates/c-api/tests/
seem to run when examples ("Test C-API" from CI) is executed.Added a CMake option to disable tests, feel free to let me know if this is not desired.