Skip to main content

Ralsina.Me — Roberto Alsina's website

My first adventure in D-Land

Yes­ter­day (or rather, like 10 hours ago?) I post­ed about my quest for a spe­cif­ic lan­guage, and men­tioned one of the can­di­dates, called D which I had found ap­peal­ing.

Well, be­cause I am a quick coder (not good, but quick) I de­cid­ed, af­ter look­ing around for about 5 min­utes, to take as my first project giv­ing the D com­mu­ni­ty a UI tool­kit.

My first choice would have been Qt, of course, but D does­n't in­ter­face well (or at al­l) with C++, and I was not about to hack a QtC bind­ing, be­cause it would be un­us­able.

So, I looked around the web for a small mul­ti­plat­form C toolk­it, and I found there are very few of those left!

You have Gtk+ and ... well, al­most noth­ing else! I found IUP though, and de­cid­ed to bind it.

Since bind­ing C libs to D is quite sim­ple, I did it most­ly by hand. And 76 files and 8872 lines of code lat­er, here is DI­UP, a D bind­ing for IUP.

Now, how do you use it?

Get IUP, then get DC, then get D, then get DI­UP, then open it, and check the ex­am­ples.

The bind­ing mod­ules them­selves are in the bind­ing fold­er, so you can com­pile ex­am­ples like this:

[ralsina@monty iupbinding]$ cd examples/elem/iupbutton/
[ralsina@monty 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
[ralsina@monty iupbutton]$ ls -lh iupbutton
-rwxrwxr-x  1 ralsina ralsina 217K Apr 18 02:30 iupbutton

You will prob­a­bly be link­ing a few libs too many, but don't wor­ry yet.

The good news:

  • IUP works on win­­dows and Unix.

  • IUP is an or­der of mag­ni­­tude smal­l­­er than WxWid­get­s.

  • Most of it seems to be work­ing.

The bad news:

  • IUP looks ug­­ly be­­cause it's mo­tif on unix.

  • IUP is pret­­ty lim­it­ed.

Some­day, when I have a free af­ter­noon, I could write a Qt back­end for IUP and avoid the suck­age plus port­ing it to OSX in the pro­cess, but...

  • IUP is damn hard to build. Luck­­i­­ly they have bi­­na­ries.

Manda­to­ry screen­shot!

So, en­joy and com­men­t!

Tom Regner / 2006-04-18 12:38:

Reading Stewart Gordons post, I just have to say that I don't deem his choice of words and phrasing bad manners - your update nevertheless is a good example thereof. If stewart is right, and you did multi-post without cross-posting, the right thing to do would be to remain silent and do better next time - and be thankful that he set your usenet manners straight without being impolite or abusive.

Maybe you had a bad day though - relax, calm down and get over it.

Kind regards, and thanks for all your work on kde!

Roberto Alsina / 2006-04-18 12:54:

I multiposted. To two newsgroups.

The number of extra posts generated by that was exactly the same as the number generated by Stewart Gordon's twitiness about my multiposting.

I am a cranky guy. I don't give a damn.


Contents © 2000-2024 Roberto Alsina