caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matthieu Dubuget <matthieu.dubuget@gmail.com>
To: caml-list@inria.fr
Subject: Ocamlbuild: could help embedding Ocaml code into shared object?
Date: Sun, 01 Jun 2008 13:01:25 +0200	[thread overview]
Message-ID: <48428185.6010503@gmail.com> (raw)

I often deliver my work as shared objects (DLL, in fact, because I'm
stuck with Windows at work).

I would like to have ocamlbuild take care of this, but I don't know
exactly how to do it?

The idea would be to split the work in two separate rules.

The first rule generates a shared object from the Objective Caml code:

rule "mloo & cmx* -> native.oo.o"
     ~dep:"%.mloo"
     ~prod:"%.native.oo.o"
     action_for_nativecode

rule "mloo & cmo* -> byte.oo.o"
     ~dep:"%.mloo"
     ~prod:"%.byte.oo.o"
     action_for_bytecode

The actions should return commands with A "-output-obj". But I do not
know how to write them. It would need a mechanism similar to the one
used for mlpack. For example, one .mloo file listing the ocaml files to
link into the output object. Dynamic dependencies are to be generated
from the content of the .mloo file.

Unfortunately, I have no idea how to write that?

The second rule would generate a shared object from the .o files.
Maybe the current clib is enough? I have to add a flag to link
the runtime engine by adding -lasmrun -lm -ldl (-lm and -ldl being
deduced from the output of ocaml* -config).

Am I looking in the right direction?

Thanks in advance for your help

Matt


             reply	other threads:[~2008-06-01 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01 11:01 Matthieu Dubuget [this message]
2008-06-05  8:46 ` [Caml-list] " Romain Bardou
2008-06-05 19:20   ` Matthieu Dubuget

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=48428185.6010503@gmail.com \
    --to=matthieu.dubuget@gmail.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).