~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to otherlibs/dynlink/dynlink.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Zacchiroli
  • Date: 2009-02-22 08:49:13 UTC
  • mfrom: (12.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090222084913-3i0uw2bhd0lgw0ok
* Uploading to unstable
* debian/control: bump dh-ocaml to (>= 0.4) to avoid buggy ocamlinit.mk

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
(*                                                                     *)
12
12
(***********************************************************************)
13
13
 
14
 
(* $Id: dynlink.mli,v 1.21 2002/11/17 16:42:11 xleroy Exp $ *)
15
 
 
16
 
(** Dynamic loading of bytecode object files. *)
17
 
 
18
 
(** {6 Initialization} *)
19
 
 
20
 
val init : unit -> unit
21
 
(** Initialize the [Dynlink] library.
22
 
    Must be called before any other function in this module. *)
23
 
 
24
 
(** {6 Dynamic loading of compiled bytecode files} *)
 
14
(* $Id: dynlink.mli,v 1.23 2008/04/22 12:24:10 frisch Exp $ *)
 
15
 
 
16
(** Dynamic loading of object files. *)
 
17
 
 
18
val is_native: bool
 
19
(** [true] if the program is native,
 
20
    [false] if the program is bytecode. *)
 
21
 
 
22
(** {6 Dynamic loading of compiled files} *)
25
23
 
26
24
val loadfile : string -> unit
27
 
(** Load the given bytecode object file ([.cmo] file) or
28
 
    bytecode library file ([.cma] file), and link it with the running program.
 
25
(** In bytecode: load the given bytecode object file ([.cmo] file) or
 
26
    bytecode library file ([.cma] file), and link it with the running 
 
27
    program. In native code: load the given OCaml plugin file (usually
 
28
    [.cmxs]), and link it with the running 
 
29
    program.
29
30
    All toplevel expressions in the loaded compilation units
30
31
    are evaluated. No facilities are provided to
31
32
    access value names defined by the unit. Therefore, the unit
37
38
    are hidden (cannot be referenced) from other modules dynamically
38
39
    loaded afterwards. *)
39
40
 
 
41
val adapt_filename : string -> string
 
42
(** In bytecode, the identity function. In native code, replace the last
 
43
    extension with [.cmxs]. *)
 
44
 
40
45
(** {6 Access control} *)
41
46
 
42
47
val allow_only: string list -> unit
68
73
    dynamically linked. A compilation unit is ``unsafe'' if it contains
69
74
    declarations of external functions, which can break type safety.
70
75
    By default, dynamic linking of unsafe object files is
71
 
    not allowed. *)
 
76
    not allowed. In native code, this function does nothing; object files
 
77
    with external functions are always allowed to be dynamically linked. *)
72
78
 
73
79
(** {6 Deprecated, low-level API for access control} *)
74
80
 
77
83
    since the default initialization of allowed units, along with the
78
84
    [allow_only] and [prohibit] function, provides a better, safer
79
85
    mechanism to control access to program units.  The three functions
80
 
    below are provided for backward compatibility only. *)
 
86
    below are provided for backward compatibility only and are not
 
87
    available in native code. *)
81
88
 
82
89
val add_interfaces : string list -> string list -> unit
83
90
(** [add_interfaces units path] grants dynamically-linked object
97
104
(** Empty the list of compilation units accessible to dynamically-linked
98
105
    programs. *)
99
106
 
 
107
(** {6 Deprecated, initialization} *)
 
108
 
 
109
val init : unit -> unit
 
110
(** @deprecated Initialize the [Dynlink] library. This function is called
 
111
    automatically when needed. *)
 
112
 
100
113
(** {6 Error reporting} *)
101
114
 
102
115
type linking_error =
113
126
  | Corrupted_interface of string
114
127
  | File_not_found of string
115
128
  | Cannot_open_dll of string
 
129
  | Inconsistent_implementation of string
116
130
 
117
131
exception Error of error
118
132
(** Errors in dynamic linking are reported by raising the [Error]