caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] findlib and ocamlopt -output-obj
@ 2011-06-05 10:18 Guillaume Yziquel
  0 siblings, 0 replies; only message in thread
From: Guillaume Yziquel @ 2011-06-05 10:18 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-05 10:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 10:18 [Caml-list] findlib and ocamlopt -output-obj Guillaume Yziquel

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