The Object-Oriented
Scripting Language
Ruby Xlib Wrap
SourceForge Logo


SourceForge Project Page




Xlib wrap is a set of SWIG (Simplified Wrapper and Interface Generator) interface files for the Ruby programming language providing a Ruby interface to the functions and structures defined in the Xlib include files X.h , Xlib.h, and Xutil.h . Although they are currently only useful with Ruby, they would be a good starting point for creating bindings for other programming languages supported by SWIG.

The Ruby interface provided by Xlib wrap should allow a developer to write an application based upon X11. It attempts to provide a one-to-one mapping between the Xlib calls and Ruby methods. All of the useful X11 structs are mapped into Ruby objects with access to the struct members. The project includes two sample files using the wrapper.

You do not need to have SWIG installed in order to use Ruby Xlib wrap. The distribution includes the SWIG generated C file, which is all you need to create the shared object loaded by Ruby. However if you plan on extended (please do!) or changing the current interface you will need SWIG. At this point, the project wraps about 70% of the functions available in the Xlib include files. Anyone needing things that have not yet been wrapped (mostly things that are difficult to wrap, requiring hand-coded wrappers) and able to understand the Ruby to C interface are invited to extend the coverage of the project and submit your changes for future inclusion. This projected is hosted by SourceForge on the project page  Ruby Xlib Wrap which contains many resources like CVS access, mailing lists, bug reports, etc.

The project is licensed under the X Open Group license under which the original Xlib include files were distributed; the changes for SWIG that I created have been put in the public domain.

Derek Ney