Version française
Home     About     Download     Resources     Contact us    
Browse thread
Dynamic libs w/ Ocaml + C code under Mac OS X
[ 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] Dynamic libs w/ Ocaml + C code under Mac OS X
Joel Stanley wrote:
> Actually, I do want a stand-alone shared library that includes the OCaml 
> runtime, but I don't think that changes the parameters of the problem 
> much.  Basically, I have an OCaml application that I'd like to wrap up 
> (together with some C glue code) into a shared library for use by other 
> applications.

Then, you should rather try something like:

   ocamlopt -output-obj -o foo.so simple.ml wrapper.c

In the CVS version, -output-obj has been extended to allow producing 
directly "standalone" .so/.dll libraries that can be loaded from C (or 
anything else).

> The only real problem with the linker invocation above was the -I 
> switch, as the linker doesn't support it.

If we simply remove the -I switch, then everything is ok?

> Hmm, -read_only_relocs still looks supported in the man page for ld 
> under 10.5.

But does the linker really accept "-read_only_relocs suppress"?

http://developer.apple.com/releasenotes/DeveloperTools/RN-Id/index.html
seems to indicate the opposite.

> Anyone have any ideas as to how I could remedy the situation?  At this 
> point it looks like I might have to switch the platform the application 
> I'm working on is used with, due to this linking problem alone.  There 
> shouldn't be a need for the code generators to produce PIC as long as 
> the linker does the right thing, correct?

Yes, correct.

00 Akaub