* ocaml not native.
@ 1999-03-04 16:31 Hugh Sasse
1999-03-05 8:27 ` Fabrice Le Fessant
1999-03-05 14:12 ` Xavier Leroy
0 siblings, 2 replies; 3+ messages in thread
From: Hugh Sasse @ 1999-03-04 16:31 UTC (permalink / raw)
To: caml-list
In htmlman/node9.html it says:
In script mode, the first line of the script is ignored if it starts with
#!. Thus, it is theoretically possible to
make the script itself executable and put as first line
#!/usr/local/bin/ocaml, thus calling the
toplevel system automatically when the script is run. However, ocaml
itself is a #! script on most
installations of Objective Caml, and Unix kernels usually do not handle
nested #! scripts.
ocamlopt builds successfully on my systems. Is there a reason why
the installation doesn't rebuild ocaml to be native code, when it can?
Is there a good reason not to attempt this myself?
(From/De http://babelfish.altavista.com/cgi-bin/translate? :
Dans htmlman/node9.html il indique:
**time-out** dans sequence type mode, premier ligne
sequence type ignorer si demarrer avec #!.
ainsi, theorique possible pour faire sequence type
soi-meme executable et mettre comme d'abord
ligne #!/usr/local/bin/ocaml, ainsi appeler toplevel
systeme automatique quand sequence type
exicuter. Cependant, l'ocaml lui-mjme est a #! siquence
type sur la plupart des installations de
Caml objectif, et les grains d'Unix habituellement ne
manipulent pas embonte #! des sequences type.
constructions d'ocamlopt avec succes sur mes systemes.
Y a-t-il une raison pour laquelle
l'installation ne reconstruit pas l'ocaml pour etre
code indigene, quand elle peut? Y a-t-il une
bonne raison de ne pas essayer ceci moi-meme?
)
Desole, mon Pine ne supportera pas des accents.
Thank you/merci,
Hugh
hgs@dmu.ac.uk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ocaml not native.
1999-03-04 16:31 ocaml not native Hugh Sasse
@ 1999-03-05 8:27 ` Fabrice Le Fessant
1999-03-05 14:12 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Fabrice Le Fessant @ 1999-03-05 8:27 UTC (permalink / raw)
To: Hugh Sasse; +Cc: caml-list
> ocamlopt builds successfully on my systems. Is there a reason why
> the installation doesn't rebuild ocaml to be native code, when it can?
> Is there a good reason not to attempt this myself?
This is a really interesting question. In fact, ocaml can't be
compiled in native code since it needs an interpreter to run the bytecode
it generates. However, the bytecode interpreter can't be integrated in
the native code system (for now ...).
A few months ago, I wrote a Dynlink library which can be integrated
in native programs (now part of the Efuns package (see homepage)).
I think it would be very interesting if, instead of using its own
linker and interpreter, the toplevel could use the general Dynlink
system. Then, any program (bytecode or native) would be able to
integrate a toplevel evaluation loop for deeper interaction with the user.
- Fabrice
Homepage: http://pauillac.inria.fr/~lefessan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ocaml not native.
1999-03-04 16:31 ocaml not native Hugh Sasse
1999-03-05 8:27 ` Fabrice Le Fessant
@ 1999-03-05 14:12 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 1999-03-05 14:12 UTC (permalink / raw)
To: Hugh Sasse, caml-list
> ocamlopt builds successfully on my systems. Is there a reason why
> the installation doesn't rebuild ocaml to be native code, when it can?
> Is there a good reason not to attempt this myself?
There is a good reason why it wouldn't work: ocaml is not an
interpreter, it's a bytecode compiler that generates bytecode on the
fly for each phrase. So, ocaml needs the bytecode interpreter.
Compiling it with ocamlopt would require an emulation of the bytecode
interpreter that can be used with ocamlopt. One such emulation exists
(written by Fabrice Le Fessant), but is not yet integrated with the
toplevel, and also runs slower than the bytecode interpreter itself.
However, there is a simpler solution to the double #! problem:
build a custom toplevel with no extensions:
ocamlmktop -custom -o /usr/local/bin/ocaml2
This packages the (bytecode) toplevel system with the runtime system,
in such a way that, viewed from the kernel, /usr/local/bin/ocaml2 is a
native executable. Then, you can write scripts with
#!/usr/local/bin/ocaml2
Hope this helps,
- Xavier Leroy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-03-08 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-04 16:31 ocaml not native Hugh Sasse
1999-03-05 8:27 ` Fabrice Le Fessant
1999-03-05 14:12 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox