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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alexander Bottema <Alexander.Bottema@m...>
Subject: RE: [Caml-list] Dynamic linking
As a developer of the MathWorks we are shipping a product containing
C/C++ code, Java code, Fortran, etc. The infrastructure that drives
everything is written in C++ and we're talking about a code base that
has been developed for more than 20 years. Every module that is based on
top of the core is written as a DLL and that's the way everything is
organized. Changing this infrastructure would be a task that would not
be reasonable by any means. It would cost the company a tremendous
amount of money and there would be no clear benefits from it. Actually,
I like the way it is being organized where every "leaf" product is just
a DLL.

Now, as a developer it would be nice if it was possible to write certain
parts in OCaml. The foreign language interface is good enough to be used
in conjunction with C/C++, but the lack of support to use it in DLLs
makes it impossible for us to have any OCaml code in our leaf product.

Nevertheless, I really tried to make it work (and I almost did). It's
only Linux/AMD64 that I couldn't solve and I really tried to modify the
AMD64 emitter.

-- Alexander Bottema
   The MathWorks

-----Original Message-----
From: Jon Harrop [mailto:jon@ffconsultancy.com] 
Sent: Tuesday, October 04, 2005 6:57 AM
To: Alexander Bottema
Subject: Re: [Caml-list] Dynamic linking

On Wednesday 28 September 2005 13:44, you wrote:
> I managed to get dynamic linking for OCaml (i.e. making OCaml
producing
> DLLs that could then be used by other native code/binaries) to work on
> almost all our supported platforms (Linux x86, Windows (2000/XP),
> Solaris 2, Mac OS X).
> The only platform which I couldn't get to work was Linux AMD64. I
tried
> to modify the OCaml emitter for AMD64 to accommodate position
> independent code using the offset tables, but it was too hard. If
anyone
> picks up this task, please let us know. As it stands today we cannot
use
> OCaml for production code.

May I ask what other approaches you have tried? In particular, why not 
statically link in the OCaml code?

I'd have thought it would then be a case of either calling everything
else 
from OCaml, or initialising the OCaml runtime and calling OCaml from 
"everything else".

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists