Chapter 25 The standard library
This chapter describes the functions provided by the OCaml standard library. The modules from the standard library are automatically linked with the user’s object code files by the ocamlc command. Hence, these modules can be used in standalone programs without having to add any .cmo file on the command line for the linking phase. Similarly, in interactive use, these globals can be used in toplevel phrases without having to load any .cmo file in memory.
Unlike the core Stdlib module, submodules are not automatically “opened” when compilation starts, or when the toplevel system is launched. Hence it is necessary to use qualified identifiers to refer to the functions provided by these modules, or to add open directives.
Conventions
For easy reference, the modules are listed below in alphabetical order of module names. For each module, the declarations from its signature are printed one by one in typewriter font, followed by a short comment. All modules and the identifiers they export are indexed at the end of this report.
- Module Arg: parsing of command line arguments
- Module Array: array operations
- Module ArrayLabels: array operations (with labels)
- Module Bigarray: large, multi-dimensional, numerical arrays
- Module Bool: boolean values
- Module Buffer: extensible buffers
- Module Bytes: byte sequences
- Module BytesLabels: byte sequences (with labels)
- Module Callback: registering OCaml values with the C runtime
- Module Char: character operations
- Module Complex: Complex numbers
- Module Digest: MD5 message digest
- Module Ephemeron: Ephemerons and weak hash table
- Module Filename: operations on file names
- Module Float: Floating-point numbers
- Module Format: pretty printing
- Module Fun: function values
- Module Gc: memory management control and statistics; finalized values
- Module Genlex: a generic lexical analyzer
- Module Hashtbl: hash tables and hash functions
- Module Int: integers
- Module Int32: 32-bit integers
- Module Int64: 64-bit integers
- Module Lazy: deferred computations
- Module Lexing: the run-time library for lexers generated by ocamllex
- Module List: list operations
- Module ListLabels: list operations (with labels)
- Module Map: association tables over ordered types
- Module Marshal: marshaling of data structures
- Module MoreLabels: Include modules Hashtbl, Map and Set with labels
- Module Nativeint: processor-native integers
- Module Oo: object-oriented extension
- Module Option: option values
- Module Parsing: the run-time library for parsers generated by ocamlyacc
- Module Printexc: facilities for printing exceptions
- Module Printf: formatting printing functions
- Module Queue: first-in first-out queues
- Module Random: pseudo-random number generator (PRNG)
- Module Result: result values
- Module Scanf: formatted input functions
- Module Seq: functional iterators
- Module Set: sets over ordered types
- Module Spacetime: memory profiler
- Module Stack: last-in first-out stacks
- Module StdLabels: Include modules Array, List and String with labels
- Module Stream: streams and parsers
- Module String: string operations
- Module StringLabels: string operations (with labels)
- Module Sys: system interface
- Module Uchar: Unicode characters
- Module Unit: unit values
- Module Weak: arrays of weak pointers