caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: "Charles 'Buck' Krasic" <krasic@cse.ogi.edu>, caml-list@inria.fr
Subject: Re: -output-obj and shared libraries?
Date: Wed, 8 Sep 1999 21:29:11 +0200	[thread overview]
Message-ID: <19990908212911.30954@pauillac.inria.fr> (raw)
In-Reply-To: <199909071601.JAA00745@giove.cse.ogi.edu>; from Charles 'Buck' Krasic on Tue, Sep 07, 1999 at 09:01:30AM -0700

> 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




      reply	other threads:[~1999-09-09 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-07 16:01 Charles 'Buck' Krasic
1999-09-08 19:29 ` Xavier Leroy [this message]

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=19990908212911.30954@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=krasic@cse.ogi.edu \
    /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).