caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* -output-obj and shared libraries?
@ 1999-09-07 16:01 Charles 'Buck' Krasic
  1999-09-08 19:29 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Charles 'Buck' Krasic @ 1999-09-07 16:01 UTC (permalink / raw)
  To: caml-list


My target platform is Linux/x86.  

Is it possible to create a .so object from ocaml?   

-- Buck

ps Please CC me in replie,  I'm not on the list.




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

* Re: -output-obj and shared libraries?
  1999-09-07 16:01 -output-obj and shared libraries? Charles 'Buck' Krasic
@ 1999-09-08 19:29 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1999-09-08 19:29 UTC (permalink / raw)
  To: Charles 'Buck' Krasic, caml-list

> My target platform is Linux/x86.  
> Is it possible to create a .so object from ocaml?   

It depends what you want to put in the shared library and how you
want to use it.

>From your mention of the -output-obj option, I infer that you'd like
to build a shared library that contains some Caml code, some C
wrappers around the Caml code, and a copy of the Caml runtime system.
This is easy to do.  Referring to the example at the end of the
"Interfacing C with Objective Caml" chapter, you'd do:

        ocamlc -custom -output-obj -o modcaml.o mod.ml
        ocamlc -c modwrap.c
	gcc -shared -Wl,-soname,libmod.so.1 -o libmod.so.1.0 \
                modwrap.o modcaml.o /usr/local/lib/ocaml/libcamlrun.a

and then install libmod.so.1.0 in a public place as usual.  Then you
can dynamically link against libmod using -lmod or dlopen().

If your question is about building shared libraries of Caml code that
can be linked dynamically against other Caml code, we don't know yet
how to do this.  A Caml program can load bytecode Caml object files at
run-time using the Dynlink library, but that's not quite the same
thing.

Best regards,

- Xavier Leroy




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

end of thread, other threads:[~1999-09-09 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-07 16:01 -output-obj and shared libraries? Charles 'Buck' Krasic
1999-09-08 19:29 ` Xavier Leroy

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