matteodelabre / waved

Experimental driver for the reMarkable 2 E-Ink display
GNU General Public License v3.0
58 stars 6 forks source link

Expose a pure C interface #11

Open LoganDark opened 2 years ago

LoganDark commented 2 years ago

C++ is nice, but one of its major disadvantages is that it's not easy or fun to FFI to it from other languages. Since name mangling, std::string layout, and so on are completely unspecified, other languages have a really really hard time interacting with C++ functions, even when the bindings are auto-generated by a C++ compiler.

waved needs to offer a C API - or else people simply won't be able to use it. The C API can't include any C++ classes/templates such as std::string, since that can't be created or touched by other languages.

All functionality of waved needs to be accessible - the C API should be the main interface (even if it uses C++ internally). If you do this right, not only will people be able to use it directly in applications but a robust display server can be implemented in a language like Rust with little friction.

matteodelabre commented 2 years ago