wasm-c-api
wasm-c-api copied to clipboard
Invert C/C++ API layering
The current C API is implemented in terms of the C++ API, but I think it would be better to invert that layering:
- The C API is the only interface defined between users and runtimes.
- Define a C++ header-only library that wraps the C API.
This means that users can use a C++-style API if they like, but runtimes only need to implement the C API.
Note that this adapter implementation is not part of the proposal but only of the prototype. The only reason I did it in that direction was that it was somewhat easier to get right, esp on top of an engine that is already in C++. I can imagine engines supporting both interfaces natively. I'd also be totally fine with adding an adapter for the other direction, as you suggest. Happy to accept patches. ;)
I can imagine engines supporting both interfaces natively.
That's what I'd like to avoid.
I'd also be totally fine with adding an adapter for the other direction, as you suggest. Happy to accept patches. ;)
To be clear, I would prefer to just get rid of the C++ API entirely. I'm not sure you want me writing the C++ adapter. :)