[gtkada] libglade and Windows

Michael Bode michael.bode at laserline.de
Wed Apr 27 16:33:23 CEST 2005


graphics at curts.mailshell.com schrieb:

> I defer to the list for the current, authoritative answer, but the 
> last that I knew libglade had not been ported to Windows. 
>

I've tried a little further and now I have the following situtation: it
works :-) At least for my very first test with a few widgets but without
callbacks etc.
This is what I did (I use gnat 3.15p / GtkAda 2.2):
- get libglade 2.0.1-bin.zip from gladewin32.sourceforge.net, this is
simply one file: libglade-2.0-0.dll
- put it in c:\gtkada-2.2.0\bin
- create a import library as described in the Gnat User Guide:
libglade-2.0-0.a (this somehow only works if one renames
libglade-2.0-0.dll to glade-2.0-0.dll)
- move libglade-2.0-0.a to c:\gtkada-2.2.0\include\gtkada
- get glade.ads, glade.adb, glade-xml.ads, glade-xml.adb from my linux box.
- change the pragma line in glade.ads to
     pragma Linker_Options ("-lglade-2.0-0");
- put the above glade packages in my application directory
- compile

Sample program (does nothing except create whatever widgets are in
glade-test.glade):

with Gtk.Main;
with Glade.XML; use Glade.XML;

procedure Window1 is
   XML : Glade_XML;

begin
   Gtk.Main.Set_Locale;
   Gtk.Main.Init;
   Gtk_New (XML, "glade-test.glade");
   Gtk.Main.Main;
end Window1;

But I'm not sure if I've got the right version mix of GtkAda and
libglade. Maybe it breaks later. If someone can tell me a better way to
get libglade running, please feel free to do so.

> I have also read that using libglade with GtkAda is frowned upon, 
> because the use of libglade bypasses some of GtkAda's strong type 
> checking. 


Of course I will get problems @ run time if I define "SampleWidget" as a
label in glade and try to use it as a button in my program, while the
compiler would have told me @ compile time.

OTOH the following line from GtkAda UG leaves me practically no
alternative to libglade:

"Under Win32 based systems, Gate will not attempt to merge changes.
Instead, it will always regenerate and overwrite every file."

So if I change the least bit of the UI in glade, it will generate a new
"empty" skeleton of Ada code and all changes I've made to the code are lost.

-- 
Michael Bode
Laserline GmbH
Fraunhoferstr.
56218 Mülheim-Kärlich
Phone:     +49 2630 964-2200
Fax:       +49 2630 964-2209





More information about the gtkada mailing list