Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Suggest ocamlopt's -dstartup place file locally, like -S does.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Mitchell N Charity <mcharity@v...>
Subject: [Caml-list] Suggest ocamlopt's -dstartup place file locally, like -S does.
I am using ocamlopt to generate object files which can be loaded by
_non_ ocaml processes.  So I compile the code with -c.  And then link
against libasmrun.a, std_exit.o, and stdlib.a.  And the .a versions of
any .cmxa's used.  This is not exactly convenient, but is not a big deal.

However, the final component, camlstartupXXXX.s, is a problem.  One
creates it by running ocamlopt with the undocumented argument -dstartup,
which says "do not delete camlstartupXXXX.s after compilation".  Which is
fine.  I just throw away the resulting standalone executable.  But where
does ocamlopt leave the camlstartup file?  In the current directory like
-S does?  No.  The file is left in /tmp .  With a semi-random name.

So after running ocamlopt, my program has to grovel through /tmp looking
for camlstartupXXXX.s files.  And then find the one that resulted from
the current compilation (it adds a randomly named symbol to the source).
This is a horrible kludge.

Which wouldn't be necessary if -dstartup, rather than just preventing
the deletion of the file in /tmp, instead also placed the file someplace
convenient.  Like "a.out.s".  Or whatever.

Why don't I just edit asmcomp/asmlink.ml myself?  Because my application
is intended to work with unmodified ocaml installations.  (It's a Perl
Inline module, Inline::OCamlOpt.  Which allows you to include ML code in
perl source files, with glue code generation, cached compilation, and
linking, all handled automagically.  Thus one can use ML, without the
cliff-face learning curve of having to code the entire application in ML.
It's a two-evening hack, but I'm already finding it useful.)

So I suggest -dstartup's behavior be slightly modified.
Though my ML is rusty, I'll do a patch if that would help.

Thank you for your work,
Mitchell Charity
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners