Re: C Libraries/Wrappers
- Posted by Icy_Viking Nov 01, 2019
- 1289 views
Also, when the next release has supports for structs, would it be easier or possible to wrap CPlusPlus libraries?
Unfortunately, the ability to interface with C++ goes well beyond structs. If that were the only boundary, we could be doing it today with manual peek/poke calls.
You'll have to contend with compiler-specific name mangling and other ABI differences like class constructors, polymorphism, exceptions, and so on.
Here's an article on how the D language accomplishes this: Interfacing to C++. They have to make a few assumptions and concessions, and even then they already have a compatible OOP syntax that mirrors C++ directly.
Matt had made some headway with doing this manually in the earliest versions of wxEuphoria, but he eventually moved to a more maintainable shim library approach instead.
-Greg
Ah I see. Well at least with the basic Euphoria struct to be coming with the next version, it should be wrapper to wrap basic C structs and modify some existing Euphoria wrappers like SDL and SFML.