Message d'erreur clair si primitive C non disponible.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1548 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jérôme Vouillon 1997-05-14 14:31:25 +00:00
parent 7db3802115
commit 6cfa61f417
3 changed files with 18 additions and 7 deletions

View File

@ -134,7 +134,7 @@ let report_error error =
open_box 0;
begin match error with
Load_failure e ->
print_string "Error during code loading:"; print_space();
print_string "Error during code loading: ";
print_string (Dynlink.error_message e)
| Unbound_identifier lid ->
print_string "Unbound identifier ";

View File

@ -15,12 +15,16 @@
open Emitcode
type linking_error = Symtable.error =
Undefined_global of string
| Unavailable_primitive of string
type error =
Not_a_bytecode_file of string
| Inconsistent_import of string
| Unavailable_unit of string
| Unsafe_file
| Linking_error of string
| Linking_error of string * linking_error
| Corrupted_interface of string
exception Error of error
@ -117,8 +121,8 @@ let load_compunit ic file_name compunit =
begin try
Symtable.patch_object code compunit.cu_reloc;
Symtable.update_global_table()
with Symtable.Error _ ->
raise(Error(Linking_error file_name))
with Symtable.Error error ->
raise(Error(Linking_error (file_name, error)))
end;
begin try
(Meta.reify_bytecode code code_size) (); ()
@ -168,8 +172,12 @@ let error_message = function
"no implementation available for " ^ name
| Unsafe_file ->
"this object file uses unsafe features"
| Linking_error name ->
"error while linking " ^ name
| Linking_error (name, Undefined_global s) ->
"error while linking " ^ name ^ ".\n" ^
"Reference to undefined global `" ^ s ^ "'"
| Linking_error (name, Unavailable_primitive s) ->
"error while linking " ^ name ^ ".\n" ^
"The external function `" ^ s ^ "' is not available"
| Corrupted_interface name ->
"corrupted interface file " ^ name

View File

@ -58,12 +58,15 @@ val allow_unsafe_modules : bool -> unit
By default, dynamic linking of unsafe object files is
not allowed. *)
type linking_error =
Undefined_global of string
| Unavailable_primitive of string
type error =
Not_a_bytecode_file of string
| Inconsistent_import of string
| Unavailable_unit of string
| Unsafe_file
| Linking_error of string
| Linking_error of string * linking_error
| Corrupted_interface of string
exception Error of error
(* Errors in dynamic linking are reported by raising the [Error]