diff6-10.chapter27.txtこのページは最後に更新されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。 last mod. 2008-08-28 (木) 09:58:49
22a23,26 > > Initialization > ============== > 27c31,32 < Initialize the library. Must be called before loadfile. --- > Initialize the Dynlink library. Must be called before any other function in > this module. 30a36,38 > Dynamic loading of compiled bytecode files > ========================================== > 35,41c43,48 < Load the given bytecode object file and link it. All toplevel < expressions in the loaded compilation unit are evaluated. No < facilities are provided to access value names defined by the < unit. Therefore, the unit must register itself its entry points < with the main program, e.g. by modifying tables of functions. < < --- > Load the given bytecode object file (.cmo file) or bytecode library file > (.cma file), and link it with the running program. All toplevel expressions > in the loaded compilation units are evaluated. No facilities are provided to > access value names defined by the unit. Therefore, the unit must register > itself its entry points with the main program, e.g. by modifying tables of > functions. 47,48c54,56 < Same as loadfile, except that the module loaded is not made < available to other modules dynamically loaded afterwards. --- > Same as loadfile, except that the compilation units just loaded are hidden > (cannot be referenced) from other modules dynamically loaded afterwards. > 50a59,60 > Access control > ============== 53c63 < val add_interfaces : string list -> string list -> unit --- > val allow_only : string list -> unit 56,63c66,75 < add_interfaces units path grants dynamically-linked object < files access to the compilation units named in list units. The < interfaces (.cmi files) for these units are searched in path (a < list of directory names). Initially, dynamically-linked object < files do not have access to any of the compilation units < composing the running program, not even the standard library. < add_interfaces or Dynlink.add_available_units[27.1] (see below) < must be called to grant access to some of the units. --- > allow_only units restricts the compilation units that dynamically-linked > units can reference: it only allows references to the units named in list > units. References to any other compilation unit will cause a > Unavailable_unit error during loadfile or loadfile_private. > Initially (just after calling init), all compilation units composing the > program currently running are available for reference from > dynamically-linked units. allow_only can be used to grant access to some of > them only, e.g. to the units that compose the API for dynamically-linked > code, and prevent access to all other units, e.g. private, internal modules > of the running program. 64a77,79 > << > val prohibit : string list -> unit > >> 65a81,83 > prohibit units prohibits dynamically-linked units from referencing the > units named in list units. This can be used to prevent access to selected > units, e.g. private, internal modules of the running program. 68c86,94 < val add_available_units : (string * Digest.t) list -> unit --- > val default_available_units : unit -> unit > >> > > Reset the set of units that can be referenced from dynamically-linked code > to its default value, that is, all units composing the currently running > program. > > << > val allow_unsafe_modules : bool -> unit 71,76c97,100 < Same as Dynlink.add_interfaces[27.1], but instead of searching < .cmi files to find the unit interfaces, uses the interface < digests given for each unit. This way, the .cmi interface files < need not be available at run-time. The digests can be extracted < from .cmi files using the extract_crc program installed in the < Objective Caml standard library directory. --- > Govern whether unsafe object files are allowed to be dynamically linked. A > compilation unit is "unsafe" if it contains declarations of external > functions, which can break type safety. By default, dynamic linking of > unsafe object files is not allowed. 79a104,106 > Deprecated, low-level API for access control > ============================================ > 81c108 < val clear_available_units : unit -> unit --- > val add_interfaces : string list -> string list -> unit 84,85c111,113 < Clear the list of compilation units accessible to < dynamically-linked programs. --- > add_interfaces units path grants dynamically-linked object files access to > the compilation units named in list units. The interfaces (.cmi files) for > these units are searched in path (a list of directory names). 86a115,117 > << > val add_available_units : (string * Digest.t) list -> unit > >> 87a119,123 > Same as Dynlink.add_interfaces[27.1], but instead of searching .cmi files > to find the unit interfaces, uses the interface digests given for each unit. > This way, the .cmi interface files need not be available at run-time. The > digests can be extracted from .cmi files using the extract_crc program > installed in the Objective Caml standard library directory. 90c126 < val allow_unsafe_modules : bool -> unit --- > val clear_available_units : unit -> unit 93,97c129,131 < Govern whether unsafe object files are allowed to be < dynamically linked. A compilation unit is ``unsafe'' if it < contains declarations of external functions, which can break < type safety. By default, dynamic linking of unsafe object files < is not allowed. --- > Empty the list of compilation units accessible to dynamically-linked > programs. > 99a134,135 > Error reporting > =============== 108d143 < 121d155 < 126,129c160,161 < Errors in dynamic linking are reported by raising the Error < exception with a description of the error. < < --- > Errors in dynamic linking are reported by raising the Error exception with > a description of the error. 140d171 < |