Module Base__.Sys
val argv : string arrayThe command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.
When running in JavaScript in the browser, it is
[| "a.out" |].
val interactive : bool Stdlib.refinteractiveis set totruewhen being executed in theocamlREPL, andfalseotherwise.
val os_type : stringos_typedescribes the operating system that the OCaml program is running on. Its value is one of"Unix","Win32", or"Cygwin". When running in JavaScript, it is"Unix".
type backend_type= Base__.Sys0.backend_type=|Native|Bytecode|Other of stringCurrently, the official distribution only supports
NativeandBytecode, but it can be other backends with alternative compilers, for example, JavaScript.
val backend_type : backend_typeBackend type currently executing the OCaml program.
val word_size_in_bits : intword_size_in_bitsis the number of bits in one word on the machine currently executing the OCaml program. Generally speaking it will be either32or64. When running in JavaScript, it will be32.
val int_size_in_bits : intint_size_in_bitsis the number of bits in theinttype. Generally, on 32-bit platforms, its value will be31, and on 64 bit platforms its value will be63. When running in JavaScript, it will be32.Int.num_bitsis the same as this value.
val big_endian : boolbig_endianis true when the program is running on a big-endian architecture. When running in JavaScript, it will befalse.
val max_string_length : intmax_string_lengthis the maximum allowed length of astringorBytes.t.String.max_lengthis the same as this value.
val max_array_length : intmax_array_lengthis the maximum allowed length of an'a array.Array.max_lengthis the same as this value.
val runtime_variant : unit -> stringReturns the name of the runtime variant the program is running on. This is normally the argument given to
-runtime-variantat compile time, but for byte-code it can be changed after compilation. When running in JavaScript, it will be"".
val runtime_parameters : unit -> stringReturns the value of the runtime parameters, in the same format as the contents of the
OCAMLRUNPARAMenvironment variable. When running in JavaScript, it will be"".
val ocaml_version : stringocaml_versionis the OCaml version with which the program was compiled. It is a string of the form"major.minor[.patchlevel][+additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The[.patchlevel]and[+additional-info]parts may be absent.
val enable_runtime_warnings : bool -> unitControls whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by
open_*functions is finalized without being closed. Runtime warnings are enabled by default.
val opaque_identity : 'a -> 'aFor the purposes of optimization,
opaque_identitybehaves like an unknown (and thus possibly side-effecting) function. At runtime,opaque_identitydisappears altogether. A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:for _round = 1 to 100_000 do ignore (Sys.opaque_identity (my_pure_computation ())) done