When making platform-agnostic headers, it becomes necessary to define Windows types compatible with POSIX types and the Windows API.
Here we use pid_t
as an example, which on Windows may be taken as equivalent to DWORD
.
Rather than include "windows.h" that is a very large header, or "windef.h" that breaks MSVC compiles, or "IntSafe.h" that includes console functions, simply apply the DWORD definition:
typedef unsigned long DWORD;
as seen in example.h.
Build and run this example
cmake -B build
cmake --build build
ctest --test-dir build -V