caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] findlib and ocamlopt -output-obj
Date: Sun, 5 Jun 2011 12:18:07 +0200	[thread overview]
Message-ID: <20110605101807.GB22132@localhost> (raw)

Hi.

I'm currently writing mixed code in OCaml and Mercury.

This means that I need to initialise Mercury by a call to mercury_init()
following guidelines in

http://www.mercury.csse.unimelb.edu.au/information/doc-release/mercury_user_guide/Stand_002dalone-Interfaces.html#Stand_002dalone-Interfaces

This requires to pass an address (i.e. stackbottom) to mercury_init
that informs Boehm's GC of where it should begin tracing. So
essentially, you need to start OCaml from a C main() and have
stackbottom allocated on main()'s stack frame. Something like:

	yziquel@seldon:~$ cat mercury_init.c 
	value mercury_stackbottom;

	int main (int argc, char ** argv) {

		void * stackbottom;	// Word aligned
		mercury_stackbottom = (value) &stackbottom;

		caml_startup (argv);

		return 0;
	}

mercury_init() then gets called as a C stub from OCaml code, and the C
stub uses the mercury_stackbottom global.

However, to generate an executable out of all that, I need to link in
quite a lot of findlib dependencies. I'm currently doing it explicitely
by calling ocamlopt with all the dependencies manually, but I failed to
manage to use ocamlfind together with the -output-obj command line
option to pull in the dependencies. Anyone knows how to do that?

-- 
     Guillaume Yziquel

                 reply	other threads:[~2011-06-05 10:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110605101807.GB22132@localhost \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@yquem.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).