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] Dynlink and unsafe modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-16 (15:22)
From: Luca Pascali <pasckosky2000@y...>
Subject: [Caml-list] Dynlink and unsafe modules
Hi to the whole team.

I'm having a little trouble using Dynlink module:
I have created a binarycode library (.cma file) that contains some 
functions I need in the application.
By statically linking this library to the executable I do not get any 
error, all works fine and I can use this library.
What I want (or I should say "what I would like") to do is to 
dynamically link this library to the executable.

I would like to say that no other module in the executable refers to the 
library. Library functions are referred by binarycode objects (.cmo 
files) dynamically loaded on request.

Now calling the Dynlink.loadfile function on the library filename (after 
the Dynlink.init ()) I get the following exception:
Dynlink.Error("this object file uses unsafe features")

What does it mean? Which kind of mistake I can have done in the library 
source that can bring to this error?
At what kind of mistakes I should pay attention when I work with the 
Dynlink module?

I tried also to call the Dynlink.allow_unsafe_modules true function to 
bypass the problem that rises the exception.
What I got is that I didn't get this exception, but I got troubles with 
a simple function in witch I use the stat of Unix in a try ... with ... 
This try/with failed to recognise the Unix.Error (Unix.NOENT,_) execption.
If I do not call the Dynlink.allow_unsafe_modules true function, this 
try/with does not fails.

Thanks in advance to everyone can help me.

Luca Pascali

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