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] Dynamic Linking Bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-27 (10:20)
From: Warp <warplayer@f...>
Subject: [Caml-list] Dynamic Linking Bug
Hi all.
Here's some bug
It comes when trying to Dynlink a CMA build with flags :
> -cclib -lmylib -dllib -lmylib
(these allow static and dynamic linking)

When I compile and run a program with
> ocamlc mylib.cma
it works.

But when I use the following into ( and compile it without the
> Dynlink.loadfile "mylib.cma"
it prints the Win32 error message "Dynamic library not found", which is
quite annoying because the name of the DLL is missing. Seems like the
dynlink_open_lib should fail with more informations (at least under Win32 :
caml_dlerror does not include the name of the module ).
So i did make it fail with the name of the library Dynlink is trying to load
, and it is "-lwin32.dll" ( seems like Dynlink doesn't like -l notation ).

Another problem with dynamic linking is that it can't be used with "-custom"
mode. When you write a DLL, you need to use caml functions to register
roots, allocations, etc... To enable access to theses functions, you need to
link with ocamlrun.lib which contains links to ocamlrun exported functions.
So when your runtime is not ocamlrun, the calls to caml functions crash. An
issue would be to have a ocamlrun.lib which links to the loading runtime. I
would be glad to know if the OCaml Team is working on that problem, or is it
"case closed" ?


Nicolas Cannasse

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: