caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mitchell N Charity <mcharity@vendian.org>
To: caml-list@inria.fr
Subject: [Caml-list] Suggest ocamlopt's -dstartup place file locally, like -S does.
Date: Thu, 10 Oct 2002 12:55:05 -0400	[thread overview]
Message-ID: <200210101655.g9AGt5118720@vendian.org> (raw)

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 wherever.

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


             reply	other threads:[~2002-10-10 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10 16:55 Mitchell N Charity [this message]
2002-10-10 17:57 ` Chris Hecker
2002-10-10 19:42   ` Mitchell N Charity
  -- strict thread matches above, loose matches on Subject: below --
2002-10-10  5:02 Mitchell N Charity

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=200210101655.g9AGt5118720@vendian.org \
    --to=mcharity@vendian.org \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).