blob: 02434726cdc7bf0f770e52561615fcc82b17977d [file]
# The Winpthreads Library
This library provides POSIX threading APIs for mingw-w64.
## Supported Windows Versions
The `winpthreads` library can run on any Windows NT system starting with
Windows NT 3.1; see configuration details below.
When configured with Win9x support, `winpthreads` can be loaded on all Win9x
systems, however it is not functional on Win9x in its current state.
Support for Win9x is in progress.
### Windows NT
You can use `--with-winnt=version` option to specify the minimal Windows NT
version you want `winpthreads` to be able to run on. The supported values are:
| Value | Meaning |
|----------|-----------------|
| nt3.1 | Windows NT 3.1 |
| nt3.5 | Windows NT 3.5 |
| nt3.51 | Windows NT 3.51 |
| nt4.0 | Windows NT 4.0 |
| win2000 | Windows 2000 |
| winxp | Windows XP |
| winvista | Windows Vista |
| win7 | Windows 7 |
| win8 | Windows 8 |
| win8.1 | Windows 8.1 |
| win10 | Windows 10 |
Default and allowed values for `--with-winnt` option are target-dependent:
| Target | Minimal Allowed Value | Default Value |
|-------------------|-----------------------|-------------------------------------------|
| x86 | `nt3.1` | `nt3.1` with mingw-w64; `winxp` with MSVC |
| x64 | `winxp` | `winxp` |
| arm32 | `win8` | `win8` |
| arm64 and arm64ec | `win10` | `win10` |
### Win9x
You can define `WINPTHREADS_WIN9X` macro to non-zero value in order to build
`winpthreads` with Win9x support.
This macro is only meaningful for x86 and is ignored on other targets.
This macro can be defined to non-zero value only when value passed to
`--with-winnt` option is `winxp` or lower.
By default, it is enabled with mingw-w64 (if the above condition is true) and
disabled with MSVC.
## Linking Against Winpthreads
For maximum compatibility, winpthreads headers expose APIs without the
`dllimport` attribute by default.
If your program is linked against the DLL, you may define the macro
`WINPTHREADS_USE_DLLIMPORT` to add `dllimport` attributes to all APIs,
which makes function calls to them a bit more efficient.
Be careful when you build static libraries; you probably do not want to define
`WINPTHREADS_USE_DLLIMPORT` unconditionally, to ensure that your code can link
against either shared or static winpthreads. Note that winpthreads does not
export any variables, which means that `dllimport` is not requred, with both
MSVC and mingw-w64 toolchains.