From 4cc324272b1f08d150417bf5333a51a39ce36336 Mon Sep 17 00:00:00 2001 From: Maxime Dénès Date: Tue, 13 Jan 2015 15:40:58 +0100 Subject: Made -print-mod-uid more silent and robust. This is a follow-up on Pierre's 5d80a385. --- library/library.ml | 8 ++++++-- library/library.mli | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'library') diff --git a/library/library.ml b/library/library.ml index 78912dbbf..f1bc49187 100644 --- a/library/library.ml +++ b/library/library.ml @@ -451,8 +451,6 @@ let rec_intern_by_filename_only id f = let m = try intern_from_file f with Sys_error s -> error s in (* Only the base name is expected to match *) check_library_short_name f m.library_name id; - if !Flags.print_mod_uid then - print_endline (Nativecode.mod_uid_of_dirpath m.library_name); (* We check no other file containing same library is loaded *) if library_is_loaded m.library_name then begin @@ -466,6 +464,12 @@ let rec_intern_by_filename_only id f = let needed = List.map (fun dir -> dir, DPMap.find dir contents) needed in m.library_name, needed +let native_name_from_filename f = + let paths = Loadpath.get_paths () in + let ch = System.with_magic_number_check raw_intern_library f in + let (lmd : seg_lib), pos, digest_lmd = System.marshal_in_segment f ch in + Nativecode.mod_uid_of_dirpath lmd.md_name + let rec_intern_library_from_file idopt f = (* A name is specified, we have to check it contains library id *) let paths = Loadpath.get_paths () in diff --git a/library/library.mli b/library/library.mli index 0a3b7d10d..13d83a5c0 100644 --- a/library/library.mli +++ b/library/library.mli @@ -78,3 +78,6 @@ val try_locate_qualified_library : qualid located -> DirPath.t * string (** {6 Statistics: display the memory use of a library. } *) val mem : DirPath.t -> Pp.std_ppcmds + +(** {6 Native compiler. } *) +val native_name_from_filename : string -> string -- cgit v1.2.3