porting to C++
by hub, Wednesday 1 April 2009 at 00:16 :: Gnome :: #656 :: rss
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:
- 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. - String and file path utilities: Boost has string algorithms and Boost.Filesystem
- 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. - 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.
- 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
Comments
Wednesday 1 April 2009 01:25, by pclouds :: #
Wednesday 1 April 2009 01:46, by schmichael :: site :: #
Wednesday 1 April 2009 02:07, by Daeng Bo :: site :: #
Wednesday 1 April 2009 02:15, by tomboy :: #
Wednesday 1 April 2009 03:04, by Stoffe :: #
Wednesday 1 April 2009 03:08, by APL4eva :: site :: #
Wednesday 1 April 2009 04:18, by anonim :: #
Wednesday 1 April 2009 04:22, by Martin :: #
Wednesday 1 April 2009 04:37, by Alexander Larsson :: #
Wednesday 1 April 2009 04:40, by nzjrs :: site :: #
Wednesday 1 April 2009 07:01, by murrayc :: site :: #
Wednesday 1 April 2009 07:28, by Ben Asselstine :: #
Wednesday 1 April 2009 07:57, by Jacinto :: #
Wednesday 1 April 2009 08:09, by dongo :: #
Wednesday 1 April 2009 08:26, by Vadim P. :: site :: #
Wednesday 1 April 2009 15:55, by hub :: #
Wednesday 1 April 2009 16:45, by nzjrs :: site :: #
Tuesday 7 April 2009 20:53, by Johnny Utah :: site :: #
Thursday 9 April 2009 09:10, by Lupine :: site :: #
Wednesday 15 April 2009 05:02, by hirnbloggade :: site :: #
Tuesday 21 April 2009 09:44, by Tom :: #
Tuesday 2 June 2009 16:44, by MainLand :: #
Saturday 27 June 2009 16:41, by keshek :: #
Saturday 27 June 2009 17:48, by hub :: #
Friday 3 July 2009 15:46, by Arkadi :: #
Post a comment
Comments are closed.