RE: wrapping wxWindows
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Dec 23, 2002
- 377 views
> From: jbrown1050 at hotpop.com [mailto:jbrown1050 at hotpop.com] > Could this be done? > > I realize that wxWindows is a C++ lib, so its not directly > compatible for > Euphoria. > > However, I once considered wrapping Qt for Euphoria (Qt is > another C++ lib, > used by such things as Opera and KDE), and I was going to do > this by cheating. > > There is a library, QtC, which wraps the C++ calls to Qt in > normal C functions, > which, in turn, can be easily wrapped in Euphoria. > > ("control::function(...)" becomes > "controltype_function(control, ...)" for > example.) > > I was wondering why this hasn't been done for wxWindows, however. > > If this approach would work for wxWindows, then that would > make it wrappable > in Euphoria. > > Can anyone think of a reason why this approach wouldn't work? I was just playing around with wxWindows a week or so ago (for windows, at least). I was using a dll version that came from Ray Smith (IIRC). I think I may have been able to create an instance of a wxObject. There are several challenges to wrapping this for Eu, at least with the approach that I was taking (it might be simpler to write a C++ wrapper that exposes everything as C and recompile). First, we must deal with name decoration. Using Depedency Walker, I was able to undecorate the names, and import functions using ordinals. I don't believe that such a linking method exists for Linux, so you'd probably have to import decorated names. Using fptr.e, I'm able to call functions by pointer, so that's not a problem. The v-tables were exported in the dll, so I could find the virtual functions. It would take some research to figure out how to overload a virtual function, however (do we need to allocate a new vtable? how do we communicate this for the new class? overwrite the function pointer that's there?). Finally, wxWindows works sorta funny (IMHO). It's going to take a lot of time going through the macros to figure out what's really going on. Matt Lewis