From: skaller <skaller@users.sourceforge.net>
To: Richard Jones <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] toplevel with pre-installed printers
Date: Fri, 20 Jan 2006 13:24:03 +1100 [thread overview]
Message-ID: <1137723843.8822.139.camel@rosella> (raw)
In-Reply-To: <20060119201847.GA28585@furbychan.cocan.org>
On Thu, 2006-01-19 at 20:18 +0000, Richard Jones wrote:
> On Thu, Jan 19, 2006 at 02:12:59PM -0500, Eric Cooper wrote:
> > In a single "master" .ocamlinit, you could dispatch on
> > Sys.executable_name, and perhaps Sys.getcwd. Still a hack, but it
> > might avoid (non-OCaml) wrapper scripts.
>
> This is a clever idea.
It's an old one too. gcc does it. The problem is portability.
You simply look at argv[0] which on some Unix systems
is the full path name of the invoked executable.
In particular, its the path name of the symlink to the
executable, not the binary. Thus, you can find the
directory containing the symlink, and thus the resources
associated with that particular symlink.
All you need is a unique symlink for every context,
and a fixed way of finding files relative to the
location of the symlink.
The problem is that there is no guarantee argv[0] is
in fact the full pathname of the symlink on all Unix
systems .. it works on Linux though.
The two other techniques commonly used to solve this problem are
(a) a wrapper script passing a command line argument
(b) an environment variable
./ocamlinit script can certainly read an environment variable.
It can also read the command line arguments .. so all you
really need is to ask for a patch to the toplevel which
allows you to pass it an argument it totally ignores!
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
next prev parent reply other threads:[~2006-01-20 2:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 16:28 Andrej Bauer
2006-01-19 16:53 ` [Caml-list] " Daniel Bünzli
2006-01-19 16:57 ` Eric Stokes
2006-01-19 17:08 ` Andrej Bauer
2006-01-19 17:49 ` Richard Jones
2006-01-19 19:12 ` Eric Cooper
2006-01-19 20:18 ` Richard Jones
2006-01-20 2:24 ` skaller [this message]
2006-01-20 16:49 ` David Brown
2006-01-20 19:29 ` skaller
2006-01-20 14:13 ` code17
2006-01-20 8:29 ` [Caml-list] " Jean-Christophe Filliatre
2006-01-20 13:13 ` Gerd Stolpmann
2006-01-19 19:40 Harrison, John R
2006-01-20 1:30 ` skaller
2006-01-20 20:19 Harrison, John R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1137723843.8822.139.camel@rosella \
--to=skaller@users.sourceforge.net \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox