diff options
| author | Xavier Leroy <xavier.leroy@inria.fr> | 2000-03-26 15:50:58 +0000 |
|---|---|---|
| committer | Xavier Leroy <xavier.leroy@inria.fr> | 2000-03-26 15:50:58 +0000 |
| commit | f5442aa165c9b96a555317655f1e814488af1744 (patch) | |
| tree | 2430131d4442fd5312de663e16af88694ae2a757 /toplevel | |
| parent | 2300f8148cec0aeb2fc825694b92529b0cd36efe (diff) | |
| download | ocaml-f5442aa165c9b96a555317655f1e814488af1744.tar.gz | |
Verification de coherence .cmo/.cmi dans #load
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2993 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'toplevel')
| -rw-r--r-- | toplevel/topdirs.ml | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml index 4019a08a12..405de6c40f 100644 --- a/toplevel/topdirs.ml +++ b/toplevel/topdirs.ml @@ -51,8 +51,25 @@ let _ = Hashtbl.add directive_table "cd" (Directive_string dir_cd) exception Load_failed +let check_consistency ppf filename compunit = + List.iter + (fun (name, crc) -> + let crc_intf = + try + Env.crc_of_unit name + with Not_found -> + fprintf ppf "Cannot find compiled interface for %s.@." name; + raise Load_failed in + if crc <> crc_intf then begin + fprintf ppf "@[<hv 0>File %s is not up-to-date with respect to@ \ + interface %s@]@." + filename name; + raise Load_failed + end) + compunit.cu_imports + let load_compunit ic filename ppf compunit = - Bytelink.check_consistency filename compunit; + check_consistency ppf filename compunit; seek_in ic compunit.cu_pos; let code_size = compunit.cu_codesize + 8 in let code = Meta.static_alloc code_size in |
