|
| 1 | +--- |
| 2 | +title: Version information |
| 3 | +--- |
| 4 | + |
| 5 | +# The `stdlib_version` module |
| 6 | + |
| 7 | +[TOC] |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +The `stdlib_version` module contains the version of the standard library. |
| 12 | +The version information can be used as a compile time constant or retrieved from a getter function at runtime. |
| 13 | +In case the standard library is dynamically linked, the version number retrieved from the getter might mismatch the compile time constants provided from the version built against. |
| 14 | +Therefore, it is recommended to retrieve the version information always at runtime. |
| 15 | + |
| 16 | + |
| 17 | +## Constants provided by `stdlib_version` |
| 18 | + |
| 19 | +### `stdlib_version_string` |
| 20 | + |
| 21 | +String constant representing the version number. |
| 22 | + |
| 23 | +### `stdlib_version_compact` |
| 24 | + |
| 25 | +Compact representation of the version string following the scheme: |
| 26 | +major * 10000 + minor * 100 + patch. |
| 27 | + |
| 28 | + |
| 29 | +### `get_stdlib_version` |
| 30 | + |
| 31 | +#### Status |
| 32 | + |
| 33 | +Experimental |
| 34 | + |
| 35 | +#### Description |
| 36 | + |
| 37 | +Getter function to retrieve version information |
| 38 | + |
| 39 | +#### Syntax |
| 40 | + |
| 41 | +`res = [[stdlib_version(module):get_stdlib_version(function)]] ([major], [minor], [patch], [string])` |
| 42 | + |
| 43 | +#### Class |
| 44 | + |
| 45 | +Pure subroutine. |
| 46 | + |
| 47 | +#### Argument |
| 48 | + |
| 49 | +`major`: shall be an intrinsic integer type. It is an optional, `intent(out)` argument. |
| 50 | +`minor`: shall be an intrinsic integer type. It is an optional, `intent(out)` argument. |
| 51 | +`patch`: shall be an intrinsic integer type. It is an optional, `intent(out)` argument. |
| 52 | +`string`: shall be a deferred length character type. It is an optional, `intent(out)` argument. |
| 53 | + |
| 54 | +#### Example |
| 55 | + |
| 56 | +```fortran |
| 57 | +program demo_version |
| 58 | + use stdlib_version, only : get_stdlib_version |
| 59 | + implicit none |
| 60 | + character(len=:), allocatable :: version |
| 61 | + call get_stdlib_version(string=version) |
| 62 | + print '(a)', version |
| 63 | +end program demo_version |
| 64 | +``` |
0 commit comments