0.0
No commit activity in last 3 years
No release in over 3 years
rubber-c-binder allows a rubyish means of generating bindings for C libraries, including (but not limited to) GObject based libraries. It allows C code to be written in the context of a ruby style class/method layout and eases type checking and conversion between Ruby & C datatypes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies
 Project Readme

Rubber Generate

v0.0.20

Template language for generating Ruby bindings for C libraries
by Geoff Youngs <g@intersect-uk.co.uk>

Introduction

A simple ruby-style bindings generator for Ruby. It allows bindings to
be laid out in a Ruby style, documentation to be included inline and
explicit type casts within C code. It’s somewhere between SWIG and pyrex.

It also allows features extconf.rb creation, including checks for headers,
pkg-config etc. The modules it creates currently depend on Ruby/GTK, but
it is planned to remove this dependency unless they genuinely require Ruby/GTK.

Other features include custom named type-maps, pre/post code inclusion within
functions and some rudimentary understanding of C code.

Changes

  • 0.0.20 – 31st Jul 2013
    – Auto-scan loaded gems for missing headers
    – Add support for %include_dir gem:foo or gem:foo/path/in/gem
  • 0.0.19 – 17th June 2013
    – Ruby 1.9 changes arguments for rb_num_coerce_cmp() – fixed.
  • 0.0.18 – 16th Nov 2012
    – Fixes for finding ruby-gnome2 header in gems
    – Improved error reporting
  • 0.0.17 – 16th Nov 2012
    – Ruby 1.9 fixes
  • 0.0.16 – 20th Oct 2011
    – Add GCC pragma to reduce warnings on unused variables
  • 0.0.15 – 18th Oct 2011
    – Add support for scanning gem directories for ruby-gnome2 headers
    – Fix missing fileutils dependency
  • 0.0.14 – 18th Oct 2011
    – Add define_on_self to genum (allow constants to be defined within submodule rather than on parent module/class)
  • 0.0.13 – 5th May 2011
    – Bug fix for gcpool
  • 0.0.12 – 3rd May 2011
    – Add support for uint64 conversion
  • 0.0.11 – 27th Apr 2011
    – Fix parsing of %min-version numbers
  • 0.0.10 – 27th Apr 2011
    – Add —install flag
  • 0.0.9 – 31st May 2010
    – Add support for —build-dir switch to specify output directory
  • 0.0.8 – 10th May 2010
    – Add support for %min-version ..
  • 0.0.7 – 7th May 2010
    – Add support for array constants (including autmatic type detection) – e.g array = [ “Text”, NULL, 3 ]
    – Add syntax_error function to parser which reports slightly more helpful syntax error messages for a .cr file
    – Add tracking of code location so that C compiler throws errors which refer to the original line in the .cr file
    – Add support for GSList{type} or GList{type} conversion to arrays as return values for functions
  • 0.0.6 – 6th May 2010
    – Flags class allows wrapping a bit field with slightly more information. Plus automatic conversion to/from ruby and support for integer values.

Dependencies

  • Ruby 1.8 / Ruby 1.9 / Ruby 2.0

Example

Sample file:

  • example/vte.cr

Usage:


$ rubber-generate —generate —build —install vte.cr

Which should generate
[arch]/vte.c <- Source code for extension
[arch]/vte.rd <- RD documentation from vte.cr
[arch]/extconf.rb <- Config script
[arch]/vte.o <- Object file
[arch]/vte.so <- Compiled extension

Installation

  $ sudo gem install rubber-generate

Credits

Author: Geoff Youngs

Contributors:

  • Vincent Isambart