Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] ocamlc linking loads dlls?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-11-15 (01:53)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] ocamlc linking loads dlls?

Am 2002.11.15 01:55 schrieb(en) Jacques Garrigue:
> From: Chris Hecker <>
> > >That point can be resolved by calling LoadLibraryEx with the
> > >According to MS docs, this prevent the call of DllMain.
> > 
> > That's better, but it still requires the dll to be available.
> I don't see your point.
> All the dlls you mention in ocaml link are supposed to be stub dlls.
> As you write them for your caml program, they are going to be
> available. If more dlls are needed, they are required by dependencies
> in those dlls, and this is what the above flag is supposed to disable.
> This looks fine.
> However, it might still be simpler to a compiler flag to disable all
> dll checking when linking. That's trivial. But if you don't know what
> you do, you're going to have runtime errors later, so this is not a
> reasonable default.

Some time ago, I ran into problems with dll checking. I tried to
embed the ocaml interpreter into another environment by loading
ocamlrun as dll. Unfortunately, I got a loop:

            (to access functions of other_environment)
         uses symbols of other_environment

>From the dll side, there is absolutely no problem, you have only to
ensure that other_environment exports all its symbols to 
subsequently loaded dlls. However, it is not possible to create
an ocaml bytecode executable for this special construction,
because ocamlc cannot load which
depends on symbols that are only dynamically available. I solved
that by playing with LD_PRELOAD, but this is really not nice.

A switch that turns dll checking off would really have helped me.
I know that embedding ocamlrun as shown is not officially supported,
but it is absolutely cool to dynamically load the whole interpreter
into any program.

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: