Skip to content
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

Invert C/C++ API layering #78

Open
AndrewScheidecker opened this issue Jun 17, 2019 · 2 comments
Open

Invert C/C++ API layering #78

AndrewScheidecker opened this issue Jun 17, 2019 · 2 comments

Comments

@AndrewScheidecker
Copy link
Contributor

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.

@rossberg
Copy link
Member

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. ;)

@AndrewScheidecker
Copy link
Contributor Author

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. :)

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

No branches or pull requests

2 participants