The standard library

# Chapter 21 The standard library

- Conventions

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 `Pervasives` module from the core library, the modules from the standard library are not automatically “opened” when a 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 `Buffer`: extensible string buffers
- Module `Callback`: registering OCaml values with the C runtime
- Module `Char`: character operations
- Module `Complex`: Complex numbers
- Module `Digest`: MD5 message digest
- Module `Filename`: operations on file names
- Module `Format`: pretty printing
- Module `Gc`: memory management control and statistics; finalised values
- Module `Genlex`: a generic lexical analyzer
- Module `Hashtbl`: hash tables and hash functions
- 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 `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 `Scanf`: formatted input functions
- Module `Set`: sets over ordered types
- Module `Sort`: sorting and merging lists
- 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 `Weak`: arrays of weak pointers