From: malc <malc@pulsesoft.com>
To: Dmitry Lomov <dsl@intellij.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Shared libraries again
Date: Sun, 22 Sep 2002 01:46:27 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.44.0209220145440.2493-100000@home.oyster.ru> (raw)
In-Reply-To: <1032627264.19770.9.camel@eddie>
On 21 Sep 2002, Dmitry Lomov wrote:
> Hi,
> is it possible build a shared C library which calls Caml code? It is OK
> if shared library uses Caml runtime statically. I do not need to
> call Caml runtime from different shared libraries - only from one,
> and it is OK for me if Caml values will be invalid outside shared
> library. That is, my shared library wholly controls Caml runtime
> startup.
*** Makefile
main: lib.so sh_c.o
cc -o $@ $+ -Wl,-rpath,.
lib.so: sh.ml
ocamlopt -c sh.ml
ocamlopt -o $@ -cclib -shared sh.cmx
sh_c.o: sh_c.c
ocamlc -o $@ -c $<
*** sh_c.c
#include <stdio.h>
#include <caml/mlvalues.h>
#include <caml/callback.h>
int main (int argc, char **argv)
{
caml_startup(argv);
callback (*caml_named_value ("ml_func"), Val_unit);
return 0;
}
*** sh.ml
let ml_func () =
print_string "moo";
print_newline ()
let _ = Callback.register "ml_func" ml_func
--
mailto:malc@pulsesoft.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2002-09-21 21:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-21 16:54 Dmitry Lomov
2002-09-21 21:46 ` malc [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=Pine.LNX.4.44.0209220145440.2493-100000@home.oyster.ru \
--to=malc@pulsesoft.com \
--cc=caml-list@inria.fr \
--cc=dsl@intellij.com \
/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