English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Uncaught Unix_error.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-06-19 (13:23)
From: Romain Beauxis <toots@r...>
Subject: Re: [Caml-list] Uncaught Unix_error.
Le jeudi 18 juin 2009 21:21:20, Stéphane Glondu a écrit :
> > I'm lost, I'd like to understand when the exception is registered: at
> > runtime initialization? In this case, only one should ever be
> > registered (at least it seems easy to enforce). Or is it statically
> > registered somehow?
> The exception is registered when the module is evaluated. This can
> happen at program startup, or during a call to Dynlink.load_file. Note
> that if Unix is linked in a cmxs file and you dynload it, you will face
> trouble.

So, if I understand it well, the C code in unixsupport.c does not match the 
expected semantics of exceptions registration.

If exceptions are registered for acess through the C code, if it is assumed 
that one can link against two modules that will provide exceptions in the same 
namespace, and if both modules registers these exceptions dynamically, then it 
should not be assumed that a global value in the C code is sufficient to get the 
exception value.

Current C code says "let's get this value once and for all". This contradicts 
the dynamic loading, hence should be changed to "let's get the *current* value 
for this exception", this being called each time one wants to raise such an