From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA13107; Sat, 21 Sep 2002 23:46:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA13215 for ; Sat, 21 Sep 2002 23:46:13 +0200 (MET DST) Received: from comtv.ru (comtv.ru [217.10.32.4]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8LLkAD04562 for ; Sat, 21 Sep 2002 23:46:13 +0200 (MET DST) Received: from [10.0.66.9] ([10.0.66.9] verified) by comtv.ru (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 4593979; Sun, 22 Sep 2002 01:46:09 +0400 Date: Sun, 22 Sep 2002 01:46:27 +0400 (MSD) From: malc X-X-Sender: malc@home.oyster.ru To: Dmitry Lomov cc: caml-list@inria.fr Subject: Re: [Caml-list] Shared libraries again In-Reply-To: <1032627264.19770.9.camel@eddie> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 #include #include 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