From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA11904; Wed, 14 Nov 2001 14:58:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA12138 for ; Wed, 14 Nov 2001 14:58:20 +0100 (MET) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fAEDwI523480 for ; Wed, 14 Nov 2001 14:58:18 +0100 (MET) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id WAA22852; Wed, 14 Nov 2001 22:58:05 +0900 To: markus@oefai.at Cc: caml-list@inria.fr Subject: Re: [Caml-list] Ocamlmakefile and Lablgtk In-Reply-To: <20011113095414.A11405@fichte.ai.univie.ac.at> References: <20011113004047.A9036@fichte.ai.univie.ac.at> <20011113091034.B22883@hars> <20011113095414.A11405@fichte.ai.univie.ac.at> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20011114225746Z.garrigue@kurims.kyoto-u.ac.jp> Date: Wed, 14 Nov 2001 22:57:46 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Markus Mottl > Florian Hars schrieb am Dienstag, den 13. November 2001: > > lablgtk comes as a library file, the problem is that every program that > > uses the library must properly initialize it before it can use it. > > gtkInit does just this: > [snip] > > But why not just link the module in the right order with the rest of > the library? Then things will be initialized as required. Or are there > circumstances where you don't want initialization? This is exactly the reason. Take for instance Unison. It is linked with lablgtk, but does not want to initialize GTK+ when used in text mode. This is very important, otherwise you would need an X-server running everytime you start Unison. While Unison was the original reason, I think it is indeed good practice to initialize by hand, without linking gtkInit.cmo. Then you know explicitely what is called and when. This avoids difficulties with debugging. Note also that in a real application there are things you want to do immediately after the initialization (or even before), and this is hard to do if you don't know where it occurs. On the other hand, if you forget to initialize, you will get a few dozen warnings, so this should not be too difficult to detect. So the rule of the thumb is: use gtkInit.cmo if you are developping with the toplevel and all your program is included in one file, but switch to explicit initialization as soon as it gets bigger. This way, OCamlMakefile should not be a problem :-) Jacques Garrigue ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr