2006-04-18 02:41

My first adventure in D-Land

Yesterday (or rather, like 10 hours ago?) I posted about my quest for a specific language, and mentioned one of the candidates, called D which I had found appealing.

Well, because I am a quick coder (not good, but quick) I decided, after looking around for about 5 minutes, to take as my first project giving the D community a UI toolkit.

My first choice would have been Qt, of course, but D doesn't interface well (or at all) with C++, and I was not about to hack a QtC binding, because it would be unusable.

So, I looked around the web for a small multiplatform C toolkit, and I found there are very few of those left!

You have Gtk+ and ... well, almost nothing else! I found IUP though, and decided to bind it.

Since binding C libs to D is quite simple, I did it mostly by hand. And 76 files and 8872 lines of code later, here is DIUP, a D binding for IUP.

Now, how do you use it?

Get IUP, then get DC, then get D, then get DIUP, then open it, and check the examples.

The binding modules themselves are in the binding folder, so you can compile examples like this:

[[email protected] iupbinding]$ cd examples/elem/iupbutton/
[[email protected] iupbutton]$ dmd -g -I../../../binding/ iupbutton.d  -L-liup -L-liupcontrols -L-L/usr/lib/iup -L-lcdiup ;
gcc iupbutton.o -o iupbutton -g -lphobos -lpthread -lm -Xlinker -liup -Xlinker -liupcontrols -Xlinker -L/usr/lib/iup -Xlinker -lcdiup
[[email protected] iupbutton]$ ls -lh iupbutton
-rwxrwxr-x  1 ralsina ralsina 217K Apr 18 02:30 iupbutton

You will probably be linking a few libs too many, but don't worry yet.

The good news:

  • IUP works on windows and Unix.
  • IUP is an order of magnitude smaller than WxWidgets.
  • Most of it seems to be working.

The bad news:

  • IUP looks ugly because it's motif on unix.
  • IUP is pretty limited.

Someday, when I have a free afternoon, I could write a Qt backend for IUP and avoid the suckage plus porting it to OSX in the process, but...

  • IUP is damn hard to build. Luckily they have binaries.

Mandatory screenshot!

So, enjoy and comment!


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina