FXRuby
FXRuby is a Ruby extension module
that provides an interface to the FOX
GUI library. It is Copyright 2001 by Lyle
Johnson and released under the GNU
Lesser General Public License.
Downloads
The latest version of FXRuby, including the source code distribution and
binaries for Microsoft Windows, are always available from the
SourceForge project page.
The SourceForge releases should always have accompanying release notes
describing the changes for that release, and a cumulative
ChangeLog
file is also included in the FXRuby source code
distribution.
The file names will always be of the form FXRuby-version.ext,
and the version indicates the compatible version of the FOX library
that you'll need if you're building from source. The binary distribution
for Windows is compatible with the standard, Cygwin-based version of Ruby
that's available for download from Ruby
Central.
Goals
The primary goal of this project is provide a complete interface to FOX
from Ruby. Ruby programs should be able to access FOX classes transparently;
this includes deriving new Ruby classes from FOX classes and overriding
their virtual functions. FXRuby is still a work in progress and not ready
for widespread use; however, the core functionality is in place and I'm
well past the "proof of concept" stage. But if you're new to Ruby, and/or
you don't know your way around a compiler and Makefiles, you may want to
hold off until a later, more mature release of FXRuby is available.
A secondary goal of the project is to promote Ruby and FOX, two great
open-source projects that both deserve wider recognition. After discovering
Ruby and monitoring the comp.lang.ruby newsgroup postings for
only a few weeks, it became apparent that users were dissatisfied with
the existing GUI options for Ruby. As with Python, Tk is the de facto standard
because of its maturity and availability on a number of platforms (including
the Macintosh). But Tk is also showing its age in many ways and it has
failed to keep pace with some of the "younger" cross-platform GUI toolkits
like FOX, wxWindows, FLTK, Qt and GTK. Of the latter five, only Qt and
GTK appear to have usable Ruby interfaces and there are some problems associated
with these as well; for Qt, it's the restrictive license for the Windows
platform version, and for GTK it's a Windows version that often lags far
behind the standard Linux/Unix version. There is clearly a need for a modern,
open-source, cross-platform GUI for Ruby, and FOX fills that need.
Building FXRuby from Source Code
If you're planning to use FXRuby on Windows, with the standard Cygwin-based
Ruby installation for Windows, you may wish to just download the pre-compiled
FXRuby binaries. Otherwise, you will need to compile the shared library
for FXRuby from the source code.
These instructions assume that you've already downloaded, compiled and
installed FOX. Next, you'll need to download the FXRuby source code tarball
and unpack it by typing:
tar xzf FXRuby-0.99.166-1.tar.gz
This will create a new directory called FXRuby-0.99.166-1. Change
to the src subdirectory and run the extconf.rb script,
specifying the locations of the FOX header files and library:
cd FXRuby-0.99.166-1/src
ruby extconf.rb --with-fox-include=/usr/local/include/fox
--with-fox-lib=/usr/local/lib
If you've installed FOX in a different location, you'll obviously need
to modify the command-line arguments for extconf.rb. Among other
things, this script checks for the presence of optional libraries for PNG
and JPEG image support. When it's done, you should end up with a Makefile
.
To start compiling FXRuby, type:
make
and then wait awhile. When it finishes compiling, install FXRuby by
typing:
make install
Now you're ready to check out the example programs.
To-do list:
-
At this early stage of development, I haven't even begun to consider
some of the more esoteric issues such as multithreaded applications, or
interactions with other popular Ruby extensions. When FXRuby itself is
basically "stable" (whatever that means) I'll be able to take the time
to study those kinds of things, so please be patient until then ;)
-
Many of the member functions for FOX classes are overloaded and so these
require some special treatment in Ruby, where function overloading isn't
supported in quite the same way as it is in C++. I am gradually working
my way through these cases and eventually all of them will work properly.
In the meantime, please let me know if you have a specific question
about how to call certain functions.
-
There are some problems related to Ruby's automatic garbage collection
mechanism, especially when FOX objects have pointers to each other. In
some circumstances, FOX expects objects to be destroyed in a certain order;
e.g., FOX expects that you're not going to destroy a shared resource like
an icon object if there are still existing widgets that use that icon.
The non-solution implemented at this time is that the underlying C++ objects
don't ever get destroyed, even when their Ruby shadow objects go away.
This in turn can lead to memory leaks in long-running applications that
create and destroy lots of widgets "on the fly".
-
More examples are always good. Instead of (or in addition to) merely cloning
the C++ examples from the standard FOX distribution, it would be nice to
have some original example programs that demonstrate Ruby's special strengths.
-
The OpenGL stuff can be made to work as well, but it required hacking on
Yoshi's
OpenGL interface code a little bit to fill in some still-missing functions.
I was working with version 0.31 of that code and I am certain that it will
continue to improve; check the various Ruby outlets for updates.
-
The build script for FXRuby (i.e. src/extconf.rb) still needs
a lot of work, especially for the various Windows build options. Please
contact me as you discover problems (and patches for those problems) for
different platforms and configurations.
Other Sources of Information
There isn't a lot about FXRuby that is specific to the Ruby language,
and so your best sources of information for FOX and FXRuby questions are
still the documentation on the FOX
Home Page, and the foxgui-users@lists.sourceforge.net mailing
list. To subscribe to the latter, please see the information on the FOX
home page.
For further information on these related technologies, click on one
of the following links:
$Id: index.html,v 1.9 2001/03/22 20:59:55 ljohnson Exp $