From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 9E681BDDB for ; Fri, 2 Sep 2005 18:17:17 +0200 (CEST) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j82GH61b017577 for ; Fri, 2 Sep 2005 18:17:07 +0200 Received: by wproxy.gmail.com with SMTP id 37so558329wra for ; Fri, 02 Sep 2005 09:17:06 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=IH/+SnzF7w8Cehs+URetaVUH92w4S0hho9mZ/RbajrOuogamL6DTA0U9vsl/aRUUpa+JCGRIZ/AiNRHLidOnAo1Vh0tQ2vZ19rJgBfqBWumEEw3qacdGJYHQgLiKTuxVGlRCl2J6le5bWU4VS/HO689IwbbVMkisfuQIgJgzxLQ= Received: by 10.54.56.77 with SMTP id e77mr2613344wra; Fri, 02 Sep 2005 09:17:06 -0700 (PDT) Received: by 10.54.103.17 with HTTP; Fri, 2 Sep 2005 09:17:06 -0700 (PDT) Message-ID: <8008871f0509020917509eadda@mail.gmail.com> Date: Fri, 2 Sep 2005 12:17:06 -0400 From: "Christopher A. Watford" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Request: Windows installers Cc: skaller In-Reply-To: <1125640801.7223.18.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1125525838.7192.23.camel@localhost.localdomain> <8008871f05083117267e99b44a@mail.gmail.com> <1125579459.7192.7.camel@localhost.localdomain> <8008871f0509011123621c1d7a@mail.gmail.com> <1125640801.7223.18.camel@localhost.localdomain> X-Miltered: at nez-perce with ID 43187B03.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 installers:01 ocaml's:01 ocaml:01 usr:01 ocamlopt:01 gcc:01 ocamlopt:01 bytecode:01 ocamlrun:01 mingw:01 ocamlrun:01 forks:01 ocamllib:01 lib:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 9/2/05, skaller wrote: > On Thu, 2005-09-01 at 14:23 -0400, Christopher A. Watford wrote: > > What I meant was that if you have TWO or even THREE Ocaml's installed, > then some ocaml tools may call others and rely on the PATH to > find them. If this the case, those tools will NOT work correctly. > EG with a path like: >=20 > PATH=3D/Cygwin/usr/bin; /MingwOcaml/bin; /NativeOcaml/bin >=20 > and you run >=20 > /MingwOcam/bin/ocamlopt >=20 > what will happen? Will it use the right gcc? Will ocamlopt, > which is a bytecode program, use the Cygwin ocamlrun instead > of the mingw ocamlrun? >=20 > The only way this can work is if the program using another > program knows the installation root. It isn't clear how > that could possibly work on brain dead systems like > Unix and Windows: perhaps on the old Mac where code had > resource forks it might work. Well my solution to this is the registry is maintained better. Like: HKLM -> INRIA -> Objective Caml -> X.YY.Z: -- OCAMLLIB (regstring): "M:\path\to\lib" -- OCAMLBIN (regstring): "M:\path\to\bin" Which then you as the coder would be responsible for looking these values up. If the damn executables were stamped with a version number you could search the path for all ocaml.exe's and check for the version you want from the image headers. I may have OCamlWinPlus search every dir on the path at startup (with a checkbox to disable that for future starts) to find all interpreters available. It would then deduce the OCAMLLIB path from the exe's path, but give the user the option of changing it. You could then do: File -> Change Toplevel ... This is probably the best you can get in this situation. > Encoding absolute pathnames is bad. Using relative lookup > is also bad. The thing is, Unix is just plain bad: the > file system is wrong, as is the language it is based on, C. >=20 > The file system should represent commands (executable files) > the same was as C should have done it, which is the way > Ocaml does do it: with closures. >=20 > > Not sure on the OCAMLLIB bit. Relevant code is startocaml.c:261: > > > > // Set the OCAMLLIB environment variable > > SetEnvironmentVariable("OCAMLLIB", LibDir); > > > > It does this right before starting ocamlrun. I would imagine this is > > necessary for ocamlrun, but hey, things might have changed. >=20 > Yes, but I'm not using ocamlrun, I'm using ocamlopt.opt, and > it doesn't seem to do this: if OCAMLLIB is set to the wrong > value, linkage fails. >=20 > I haven't been able to get it to work with OCAMLLIB=3D"" either, > despite claims in the documentation that this is only needed > under Win98 etc, it seems to be needed on XP as well, and > it has to be correct. This is slightly nasty for my build > scripts .. I have to calculate the correct OCAMLLIB to use > for a given 'ocamlc/ocamlopt' and run it like >=20 > env OCAMLLIB=3Dxxxx ocamlc .... >=20 > ... I'm not sure how to do that with Win32 shell CMD.EXE. C:\> SET OCAMLLIB=3Dxxx C:\> ocamlc .... > My scripts all use system() function calls, which is > rather nasty .. turns out even under Cygwin, system() > calls CMD.EXE after one level of indirection (or something > similar .. I haven't quite worked it out). You can use SetEnvironmentVariable() with windows before your system() calls if you would like. #include #pragma comment(lib, "kernel32.lib") BOOL SetEnvironmentVariable( LPCTSTR lpName, LPCTSTR lpValue ); >=20 > -- > John Skaller Hope that helps --=20 Christopher A. Watford christopher.watford@gmail.com http://dorm.tunkeymicket.com