Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] -ccopt -shared
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] -ccopt -shared
> > If you really want to create a shared library containing OCaml code
> > and the OCaml runtime system, this can be done, but you need to use
> > ocamlc -output-obj or ocamlopt -output-obj to package the OCaml code
> > as a C object.
> 
>  And the resulting code will be PIC on x86 with a native compiler? 

No.  It will not be position-independent code.  But good dynamic
linkers such as those of Linux and Windows do not require
position-independent code; they can also load dynamically code
containing absolute references.  This is a bit slower than dynamically
linking pure PIC code, and prevents the sharing of the code segment
between several processes that load the shared library, but it still works.

> Is it already usefull?

Depends what you need shared libraries for.  If your goal is to reduce
memory consumption because many running processes share the library,
then no, it's not useful.  But it *is* useful if your goal is to
interface with another system that cannot statically link with your
code and absolutely requires foreign code to be a shared library, such
as Java's native method interface, or COM's "in-proc" components.

- Xavier Leroy


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr