Re: lablgtk-2.16.0 and initialization

Jacques Garrigue <[email protected]> Sat, 6 Oct 2012 21:44:50 +0900
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
On 2012/10/06, at 19:17, Philippe STRAUSS <[email protected]> wrote:

> Hello Lablgtk developpers,
> 
> I've did a tryout of lablgtk 2.16.0 on OSX, both 10.7.5 and 10.6.8, gtk provided by macports:
> 
> gtk2 @2.24.12_0+x11 (active)
> 
> but it seems some initialization has changed.
> 
> building the examples directory, it seems only the one using a *.Main.init ()
> examples works as expected, the others bombs out with a null pointer referenced in gtk runtime as the first error message.
> 
> I've reverted to 2.14.2 temporarily. I still have an ocaml 4.00 / lablgtk 2.16.0 combo on a box to test in case.

This is actually the expected behavior.
I suppose that macports was doing something strange before.
Namely, the examples are intended to be run using the lablgtk2 script, as explained in the README.
If you want to link them, you must either add explicitly gtkInit.cmo, or use the lablgtk2.auto-init package
with ocamlfind.
The advantage of not initializing by default is that you can build applications with both a text interface
and a GUI, and switch according to the context.

	Jacques