Am Sonntag, den 18.12.2011, 17:39 +0200 schrieb Dmitry Grebeniuk:
> Hello.
> 
> > Do "head -1 prog" to see the right ocamlrun.
> 
>   Thank you, this really helped, but in the other way.
> I've found that this executable has ELF format.
> So, this is a -custom linked bytecode executable.
>   But I can't find anywhere in the documentation
> any information about whether can I / should I run
> such executables using ocamlrun or I can't / I shouldn't.
>   If the answer is "I can't / I shouldn't", then the problem
> is solved (and maybe I should report a
> documentation-related issue to mantis?).
> 

This explains it. An executable compiled with -custom is self-contained,
and all add-on C libraries (like Unix) are linked in. Because of this,
such an executable does not include a loader section for add-on
libraries, and you normally cannot run it with ocamlrun (except for the
corner case that no extra libraries are needed).

However, if you link without -custom, the generated bytecode includes
the information which extra libraries are needed, and ocamlrun will load
these libraries.

You can, however, run prog with a special version of ocamlrun that
statically links the extra libraries in. E.g. create a special ocamlrun
that includes Unix:

ocamlc -o myrun -make-runtime unix.cma

Then ./myrun prog should work (provided that Unix is the only missing
lib).

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    [email protected]
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.
------------------------------------------------------------



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to