Re: SWITCH problem - need thoughts
- Posted by jimcbrown (admin) Apr 17, 2016
- 1574 views
EuWinGui on 4.x is a strange setup.
EuWinGui has a closed source (C?) library that was written for 3.x or earlier, and it uses the C interface from that version (e.g. include/euphoria.h et al.), which is not compatible with 4.0.0 or later. (Attempts to pass 4.0.0 objects directly to 3.1.1 result in a machine level exception.) Then the euphoria side passes euphorian objects directly with E_OBJECT, E_SEQUENCE, E_ATOM, or E_INTEGER.
To get it to work, I added an extra layer, written with Euphoria 3.1.1 and compiled against it. The Euphoria side (now 4.x) takes the euphoria object and uses sprint() and allocate_string() to turn it into a valid C string, which is passed to the 3.1.1 layer. THe 3.1.1 layer takes the C string, turns it into an Euphorian string, then uses value() to reconstruct the Euphorian object. Then that object is passed to the closed source (C?) library.
Return values work the same way. The Euphoria object returned by the closed source library is taken by the 3.1.1 layer and turned into a C string, then that is passed to the 4.x layer which turns it back into an Euphorian object again.
That said, if memory serves correctly, EuWinGui was actually written for Euphoria 2.3 or 2.4, so there might be some subtle incompatibility between the 2.x include/euphoria.h and the 3.x include/euphoria.h that is causing problems. Also, there are some values, such as nan and inf, which can't be passed back and forth with the sprint()/value() method. Somehow one of the edge cases might be getting hit here.
With tinEWG, it's all open source and no extra C library layer, so it wouldn't have these sort of problems.
I don't think the original author is supporting EuWinGUI anymore, so I'd recommend to everyone who wants to continue to use a similar API to migrate to tinEWG ASAP.