Context: we are building cross-platform application from linux (ubuntu). We use the available mingw-w64 from ubuntu packages (v7.0.0-2 at the time of writing). We would like to start using the Windows ConPTY API (aka pseudo-console). Is there support for ConPTY in mingw-w64? Anyone has done it before? Thanks
It looks like ConPTY dedicated functions are enabled only for windows WINNT and windows NTDDI version _WIN32_WINNT_WIN10
and NTDDI_WIN10_RS5
respectively, or newer. MinGW (7.0.0-2) sets the WINNT version to _WIN32_WINNT_WS03
(Windows Server 2003) by default.
By setting those values manually before including windows.h
it is possible to use ConPTY functions with Ubuntu's MinGW-w64 package v7.0.0-2.
Example code:
#define NTDDI_VERSION 0x0A000006 //NTDDI_WIN10_RS5
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10
#include <windows.h>
#include <wincon.h>
CreatePseudoConsole(size, inputReadSide, outputWriteSide, 0, &hPC);