diff --git a/src/node_http2.h b/src/node_http2.h index 5bd715da8a2697..4c1c21798138ff 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -3,6 +3,20 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS +// nghttp2.h needs ssize_t to compile on Windows. +// Refs: https://github.com/electron/electron/pull/35350#discussion_r954890551 +// Same as +// https://github.com/nodejs/node/blob/bb4dff783ddb3b20c67041f7ccef796c335c2407/src/node.h#L212-L220. +#ifdef _WIN32 +#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) +typedef intptr_t ssize_t; +#define _SSIZE_T_ +#define _SSIZE_T_DEFINED +#endif +#else // !_WIN32 +#include // size_t, ssize_t +#endif // _WIN32 + // FIXME(joyeecheung): nghttp2.h needs stdint.h to compile on Windows #include #include "nghttp2/nghttp2.h"