Wrapping libinfinity
This week I have been working on creating a C++ wrapper for libinfinity. The library uses a gobject API and is very extensible, so ditching it in favor of a non-glib library would be a real waste. Luckily, there are tools like gmmproc (an internal glibmm tool) which auto-generates the C++ classes to wrap gobject based libraries, given that you don’t mind using the gtkmm source code as your documentation. Aside from having a fun time dissecting various libraries to figure out how to use gmmproc, the application is absolutely awesome. The tool reads from definition files (which can also be auto-generated from other glibmm/pygtk tools) which store data on the library’s object names, their member functions, parameters, etc. and parses .hg and .ccg files which contain C++ code with macros (such as _WRAP_METHOD) into source files which are fed to the compiler. Some documentation can be found in the gtkmm book: http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/chapter-wrapping-c-libraries.html. After getting the hang of the tool usage, wrapping the library is a breeze, so a usable version will be on its way very soon.


Write a Comment