Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlnlffi-lib / memory / linkage.sig
CommitLineData
7f918cf1
CE
1(* linkage.sig
2 * 2005 Matthew Fluet (mfluet@acm.org)
3 * Adapted for MLton.
4 *)
5
6(* linkage.sig
7 *
8 * This module defines a high-level interface for dlopen.
9 * While addresses (those obtained by applying function "addr" below
10 * or addresses derived from those) will not remain valid across
11 * export{ML,Fn}/restart, handles *will* stay valid.
12 *
13 * Copyright (c) 2004 by The Fellowship of SML/NJ
14 *
15 * Author: Matthias Blume (blume@tti-c.org)
16 *)
17signature DYN_LINKAGE = sig
18
19 exception DynLinkError of string
20
21 type lib_handle (* handle on dynamically linked library (DL) *)
22 type addr_handle (* handle on address obtained from a DL *)
23
24 val main_lib : lib_handle (* the runtime system itself *)
25
26 (* link new library and return its handle *)
27 val open_lib : { name: string, lazy: bool, global: bool } -> lib_handle
28 val open_lib' : { name: string, lazy: bool, global: bool,
29 dependencies: lib_handle list } -> lib_handle
30
31 (* get the address handle of a symbol exported from a DL *)
32 val lib_symbol : lib_handle * string -> addr_handle
33
34 (* fetch the actual address from an address handle; the value obtained
35 * is not valid across export{ML,Fn}/resume cycles *)
36 val addr : addr_handle -> MLton.Pointer.t
37
38 (* unlink previously linked DL; this immediately invalidates all
39 * symbol addresses and handles associated with this library *)
40 val close_lib : lib_handle -> unit
41end