caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Christoph Höger" <christoph.hoeger@celeraone.com>
To: OCaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] In-memory assembly
Date: Wed, 10 Jan 2018 11:20:22 +0100	[thread overview]
Message-ID: <CAOazmvuH+DPaoEsEcXX2W0zv8J6po5h=2tmmiCg6d1U6Ad1t-w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

Dear all,

I want to trigger OCaml compilation programmatically from a C++ application
and avoid the usage of subprocesses. It is fairly straightforward to
generate an OCaml AST, but I cannot compile it.

1. The relevant modules/libraries do not load

  utop # #require "compiler-libs.optcomp";;
  Error: Reference to undefined global `Location'

  X86_masm.generate_asm stdout [] ;;


2. The relevant modules seem to insist on file i/o for communication (i.e.,
they use out_channel objects)


Does anyone know a simple way around these issues?

a) Can I load the optcomp library without modifying the compiler (or with
some simple modifications)

b) Is there a way to create an out_channel  from a memory buffer?

thanks,

Christoph

ps: If the answer to both questions is "no", I would be willing to work
with the community and enhance the compiler if I could get some advice on
how to do it best and if such a modification is wanted.

[-- Attachment #2: Type: text/html, Size: 1169 bytes --]

             reply	other threads:[~2018-01-10 10:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 10:20 Christoph Höger [this message]
2018-01-10 10:41 ` Gabriel Scherer
2018-01-10 15:42   ` Evgeny Roubinchtein
2018-01-10 16:46 ` Basile Starynkevitch

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='CAOazmvuH+DPaoEsEcXX2W0zv8J6po5h=2tmmiCg6d1U6Ad1t-w@mail.gmail.com' \
    --to=christoph.hoeger@celeraone.com \
    --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).