Skip to content

Library that provides dynamic runtime bindings to libraries introspectable via GObjectIntrospection, ie, Glib, GObject, Gtk, WebKit, Soup. Utilizes `mruby-gobject-introspection`

Notifications You must be signed in to change notification settings

ppibburr/mruby-girffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

MRuby library that provides complete API access to C libraries introspectable by GObjectIntropsection Bindings are dynamicaly generated as needed via usage of mruby-gobject-intropsection

Will also run on CRuby 1.9.x, mruby-gobject-intropsection's mrblib and ffi are required.
(However this is a secondary objective as the primary target is mruby)

Several libraries exist to make common GObject based bindings more Ruby-like
Some niceness is built in mruby-girffi for GObject, Gtk >= 2.0, WebKit >= 1.0
Typically when the Rubyifcation of an api goes out the scope of core mruby-girffi I create these.

Thus far:

Requirements

MRBGEMS:

Libraries:

Data:

  • GIRepository Typelibs for the bindings you wish to use.

Example

GirFFI.setup :Gtk #, [2.0, 3.0][1] # specify a version

Gtk::init(1,["MRuby-GirFFI Application"])

w = Gtk::Window.new(Gtk::WindowType::TOPLEVEL)
w.add b=Gtk::Button.new_from_stock(Gtk::STOCK_QUIT)

b.signal_connect "clicked" do |widget, data_always_nil|
  Gtk::main_quit
end

w.show_all()

Gtk::main()

Features

  • Built in enhancements for GObject, Gtk and WebKit
  • Ruby style method invokation. (self, string_required, may_be_null, callback, out_param) becomes (string, *o, &b).
  • Instantly write applications using the latest GObject based libraries. (nightly builds, even your own, if you compile your own typelibs)
  • Generate documentation for built libraries with mruby-girffi-docgen

Cons

  • A slight smell of C is left over
  • Differences compared to the CRuby Gtk2 official bindings (method arguments order may differ. Constant naming conventions may differ)

TESTS

One needs girepository dev files
This builds the Regress-1.0 library

# build the test library, etc, and run
# gnerated files go to ./tmp
# expects mruby root to be one level above current dir
# ie: ../mruby
make test

# clean
make clean

TODO

  • Makes no attempt to manage memory
    Some will be implemented, but limited to instructions in typelibs.

Authors

ppibburr tulnor33@gmail.com

LICENSE

MIT

About

Library that provides dynamic runtime bindings to libraries introspectable via GObjectIntrospection, ie, Glib, GObject, Gtk, WebKit, Soup. Utilizes `mruby-gobject-introspection`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published