caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* compiling ocaml into a shared object
@ 2006-12-14 13:10 Hendrik Tews
  2006-12-14 13:24 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Hendrik Tews @ 2006-12-14 13:10 UTC (permalink / raw)
  To: caml-list

Hi,

could somebody tell me how to compile ocaml sources into a shared
object that can be loaded with dlopen? The following message
seems to tell me that this is possible:
http://caml.inria.fr/pub/ml-archives/caml-list/2001/12/e2092b52999522eaa0bbc099b07cf4e1.en.html 

I tried 

  ocamlopt -output-obj -o ocaml-dlex.so dlex.ml 

but on 

  dlopen ("/home/tews/src/ocaml/ocaml-dlex.so", RTLD_LAZY);

I get 

  dlopen error: /home/tews/src/ocaml/ocaml-dlex.so: only ET_DYN and ET_EXEC can be loaded


Passing -ccopt -shared to ocamlopt changed nothing. In fact it
seems that -output-obj discards all -ccopt options!


Bye,

Hendrik


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] compiling ocaml into a shared object
  2006-12-14 13:10 compiling ocaml into a shared object Hendrik Tews
@ 2006-12-14 13:24 ` Richard Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Jones @ 2006-12-14 13:24 UTC (permalink / raw)
  To: Hendrik Tews; +Cc: caml-list

On Thu, Dec 14, 2006 at 02:10:31PM +0100, Hendrik Tews wrote:
> could somebody tell me how to compile ocaml sources into a shared
> object that can be loaded with dlopen? The following message
> seems to tell me that this is possible:

It's tricky, but I managed to compile the bytecode interpreter and
bytecode into a shared object.  See the source for mod_caml.so:

http://download.savannah.nongnu.org/releases/modcaml/
(actually there's a much newer version in CVS, but I don't think the
linking issue changed at all).

For AMD64, see also:

http://merjis.com/developers/mod_caml/amd64

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] compiling ocaml into a shared object
  2006-12-15  5:29 oleg
  2006-12-15  8:45 ` [Caml-list] " Hendrik Tews
@ 2006-12-15  9:17 ` Richard Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Jones @ 2006-12-15  9:17 UTC (permalink / raw)
  To: caml-list

On Thu, Dec 14, 2006 at 09:29:26PM -0800, oleg@pobox.com wrote:
> Here's an example of a subtle bug (which also may be present in the
> `Ancient' extension announced on this list some time ago). 
> 
> 	let v = Array.create 256 iv in
> 	Array.length v

Ancient gives 256 as the answer, but I will check the MetaOCaml
discussion anyway just in case this problem affects other parts of
Ancient.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] compiling ocaml into a shared object
  2006-12-15  5:29 oleg
@ 2006-12-15  8:45 ` Hendrik Tews
  2006-12-15  9:17 ` Richard Jones
  1 sibling, 0 replies; 4+ messages in thread
From: Hendrik Tews @ 2006-12-15  8:45 UTC (permalink / raw)
  To: caml-list


Thanks for the pointers, but all these sounds to bleeding edge
for me. I simply use static linking then.

Hendrik


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-15  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-14 13:10 compiling ocaml into a shared object Hendrik Tews
2006-12-14 13:24 ` [Caml-list] " Richard Jones
2006-12-15  5:29 oleg
2006-12-15  8:45 ` [Caml-list] " Hendrik Tews
2006-12-15  9:17 ` Richard Jones

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