In my attempts to fight my own boredom, as an unemployed hacker[1], I took on myself to do something: porting Tomboy to C++. It is actually not that hard, just a lot of work to do manually because there is over a dozen of thousands of lines of code. This show me that the door is open to reimplementing Gtk# software (or parts) in C++ with not too many problems, making it easy to have them available for C applications.

Nonetheless there are still some challenges:

  1. Garbage collection: I replaced this with a combination of Gtkmm memory management, std::tr1::shared_ptr<> and stack allocated object. Seems to be working so far. I could also be using a garbage collector, but it seems to be unecessary.
  2. String and file path utilities: Boost has string algorithms and Boost.Filesystem
  3. XML: while XML parsing is not a big issue with the various libraries available, APIs have enough difference to make it non-trivial. I also had to write a convenient wrapper of xmlTextWriter to make my life easier.
  4. Add-ins: I don't have the support for generic addins as found in Mono. No big deal, I implemented a factory in a few lines with a couple of macros. Some core features are actually implemented as add-ins, so I had to do it. Dynamic loading shouldn't be too hard.
  5. regex: some of these core feature use regulars expression. Not a big deal if it wasn't for apparently different syntax.

To help all of this, I have implemented a small library (in the same tree) called "sharp" aimed at helping port from Gtk#. In addition to boost, I also make an extensive use of Gtkmm and libxml++.

Of course the code is available. I have set up a repository on gitorious (Edit: Apr 1st 2016) — it is in GNOME git ; gitorious is dead.(/Edit) There is no tarball yet as I still need to iron a few major bugs. On over 13KLOC of code, there are to be some :-)

Notes

[1] emphasis mine