Re: Automating GUI's using Euphoria
- Posted by mattlewis (admin) Jan 22, 2013
- 1394 views
You are already working on wxEuphoria which "is relatively straightforward" and presumably will "show most of the intricacies involved."
You would think that, but surprisingly, that is not the case. wxEuphoria is written almost entirely in C++ and it "speaks Euphoria" by passing native Euphoria objects around (a lot of C++ hackery is involved here).
Yes, the problem is that a library written in C++ that only provides a C++ interface is nearly impossible to wrap with anything but C++. Originally, I did some stuff to figure out how the compiler would mangle the names, but it was very time consuming, and made updates extremely difficult. You also ended up with different source files for different compilers (including different versions of the same compiler!) / platforms.
The amount of C++ involved in wrapping new methods is typically fairly small. I created some helper routines that do things like convert a sequence into a wxString and vice versa. There are also some macros that make wrapping constructors pretty painless. Most calls involve a couple of casts and most of the wrappers are very thin. There are some places where the C++ wrappers do a bit more in order to make the euphoria interface easier.
I believe that all of the wxWidgets language bindings take a similar approach, or include wxWidgets directly into their language runtime.
Matt