# Fortran Standard Library is already available under the Windows-MSYS2 environment

**URL:** <https://fortran-lang.discourse.group/t/fortran-standard-library-is-already-available-under-the-windows-msys2-environment/5682>\
**Category:** Announcements\
**Created:** [April 28, 2023, 1:09am UTC](https://fortran-lang.discourse.group/t/fortran-standard-library-is-already-available-under-the-windows-msys2-environment/5682 "2023-04-28T01:09:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [April 28, 2023, 1:09am UTC](https://fortran-lang.discourse.group/t/fortran-standard-library-is-already-available-under-the-windows-msys2-environment/5682/1 "2023-04-28T01:09:51Z")

</div>

[Windows-MSYS2](https://www.msys2.org/) environment is simple enough to use, Fortran Standard Library can now be easily accessed from MSYS2:

- [mingw-w64-fortran-stdlib-0.2.1 package submission](https://github.com/msys2/MINGW-packages/pull/16957);
- [stdlib repo](https://github.com/fortran-lang/stdlib).

stdlib can be obtained from MSYS2 using the following command:

```sh
> pacman -Sy
> pacman -S mingw-w64-x86_64-fortran-stdlib

```

## Use stdlib in [Meson](https://mesonbuild.com/)

`demo.f90`:

```fortran
program example_gcd
use stdlib_math, only: gcd
implicit none
integer :: a, b, c
a = 48
b = 18
c = gcd(a, b) ! returns 6
print *, c
end program example_gcd

```

`meson.build`:

```meson
project(
'demo',
'fortran',
)
executable(
'demo',
'demo.f90',
dependencies: dependency('fortran_stdlib'),
)

```

Building the code:

```sh
> meson setup _build
> meson compile -C _build
> ./_build/demo.exe
6

```

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 28, 2023, 8:09am UTC](https://fortran-lang.discourse.group/t/fortran-standard-library-is-already-available-under-the-windows-msys2-environment/5682/2 "2023-04-28T08:09:58Z")

</div>

Great! This is the stdlib page in this MSYS2 packages directory:  
[https://packages.msys2.org/base/mingw-w64-fortran-stdlib](https://packages.msys2.org/base/mingw-w64-fortran-stdlib)
