1. 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
2. RE: wrapping wxWindows
- Posted by Ray Smith <smithr at ix.net.au> Dec 24, 2002
- 396 views
Hi jbrown, This I'm sure can be done, but with a huge amount of work. David Cuny would be the one to ask specific questions of as he has wrapped alot of the wxWindows objects into his Basic interpreter (wxbasic.sourceforge.net). He has done it in a way that "almost" works automatically. I had tried a couple of times to do it manually but failed to get to grids with wxWindows programming. I got along way down the path of doing the same type of things with FLTK and the Fox GUI toolkits. FLTK is C "friendly" which makes things easier (ie. users callbacks for events - which is easy to wrap in Euphoria callbacks). The Fox GUI toolkit uses a similiar event loop to wxWindows which means you have to write a C wrapper before you can connect it to Euphoria (lots of work). I'm certain it's all possible but does take alot of work. When I struggle just to get these libraries compiled I realise that I'm not prepared to put the huge amount of effort in writting C and C++ code to get the payback for Euphoria. I think it would be a fantastic project for someone!!!! I beleive "good" wxWindows support would make Euphoria an excellent tool to develop cross platform GUI apps with! Regards, Ray Smith http://rays-web.com > 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?
3. RE: wrapping wxWindows
- Posted by Ray Smith <smithr at ix.net.au> Dec 24, 2002
- 372 views
Matthew Lewis wrote: > 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 don't think it was me? (that I can remember anyway) I have built the DLL version a few times attempting a wxWindows wrapper but I'm pretty sure I didn't send anything to anyone. Regards, Ray Smith http://rays-web.com
4. RE: wrapping wxWindows
- Posted by Ray Smith <smithr at ix.net.au> Dec 24, 2002
- 370 views
jbrown1050 at hotpop.com wrote: > I was hoping that I could make a C library, not a C++ library. > > Perhaps if I did a 2-step triple C wrap. > > wxWindows -> wrapped in plain C, exported as a C++ library. > C++ wrapper lib -> wrapped again in plain C, but exported as a normal C > lib this time. > C wrapper lib -> wraps cleanly in Euphoria. I "think" the easiest path is to write a C++ library (since wxWindows is written in C++) but create the "wrapped" routines in a "C friendly" way (by using extern C{...} ). A library such as this wrapped in a DLL looks just like a C DLL (and I assume the same for shared libraries on *nix). This is the approach I was using for FLTK and FOX and it seemed to work fine. Regards, Ray Smith http://rays-web.com