Skip to content

Commit

Permalink
Dynlink state API: change to what was done in the first iteration.
Browse files Browse the repository at this point in the history
The naming is consistent with what is done at the compilation unit
level.
  • Loading branch information
dbuenzli committed Sep 28, 2020
1 parent b631c71 commit 23314da
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions rfcs/ocamlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,25 @@ loaded.
A call to `Dynlink.assume_library n` add library name `n` to the set of
loaded libraries names without loading anything.

We also add the following functions to query the state of the program w.r.t.
to loaded libraries.
Mirroring the existing support for compilation untis, we also add the following
functions to query the state of the program w.r.t. to loaded libraries.

```
Dynlink.loaded_libraries : unit -> string list
(** [Dynlink.loaded_libraries ()] is the
the list of library names loaded in the program
(including libraries already linked in the executable). *)
val Dynlink.main_program_libraries : unit -> string list
(** [main_program_libraries ()] is the list of library names statically linked
in the program. *)
val Dynlink.public_dynamically_loaded_libraries : unit -> string list
(** [public_dynamically_loaded_libraries ()] is the list of library names
that were dynamically loaded as a side effect of {!loadfile},
{!loadfile_private} or {!loadlib}. *)
val Dynlink.all_libraries : unit -> string list
(** [all_libraries ()] is the union of {!main_program_libraries} and
{!public_dynamically_loaded_libraries}. *)
Dynlink.is_library_loaded : string -> bool
(** [Dynlink.is_library_loaded l] is
[List.mem l (Dynlink.loaded_libraries ())] *)
val Dynlink.has_library : string -> bool
(** [Dynlink.has_library l] is [List.mem l (Dynlink.all_libraries ())]. *)
```

Keeping track of library names present in the executable and those
Expand Down

0 comments on commit 23314da

Please sign in to comment.