Version française
Home     About     Download     Resources     Contact us    
Browse thread
C libs from Ocaml libs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] C libs from Ocaml libs
viktor tron wrote:
> This is super! how is this on MacOS, I recall one of your comment earlier (on this list?)
> that it doesn't work or something. 

Everything should work fine under Mac OS X x86. For PowerPC, I believe 
that "ocamlc -output-obj -o XXX.so" should be ok but that "ocamlopt 
-output-obj -o XXX.so" does not work.

> well, I tried.
> ar -rs foo_caml.o foo_stub.o
 > gcc -o foo_test.native foo_test.c -L. -lchainfreq_native -L/sw/lib/ocaml

What is the name of the library you want to produce?

>      > * how do I create dynamic libs, dlls for windows?
> 
>     What do you want to put in your dynamic libs? If you want to create a
>     "stand-alone" dll with the OCaml runtime + arbitrary OCaml and C code,
>     the new behavior of "-output-obj -o XXX.{so,dll}" is/will be what
>     you want. 
> 
> 
> and not standalone ones?

So, you want the OCaml code, but not the OCaml runtime?  You can either 
use the -shared option to produce a .cmxs plugin (that must be 
explicitly loaded by the main program, using the OCaml Dynlink module), 
or -output-obj to produce a .o containing the OCaml code and the startup 
code for the OCaml side of your application.

-- Alain