Skip to content

Commit 38014b6

Browse files
committed
embed: Adjust windows includes to minimize pulled in APIs.
1 parent 5f90be0 commit 38014b6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Embedded/np_embed.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#define NUITKAPYTHON_EMBED_BUILD
22
#define _FILE_OFFSET_BITS 64
33
#include "np_embed.h"
4+
#ifdef _WIN32
5+
#include <windows.h>
6+
#endif
47
#include <ctype.h>
58
#include <stdarg.h>
69

Include/np_embed.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef NUITKAEMBED
77
#define NUITKAEMBED
88

9-
#ifndef __ASSEMBLER__
9+
#if !defined(__ASSEMBLER__) && !defined(BYPASS_NP_EMBED)
1010
#ifdef __cplusplus
1111
extern "C" {
1212
#endif
@@ -16,12 +16,13 @@ extern "C" {
1616
#endif
1717

1818
#ifdef FOPEN_MAX
19-
// This means that were were loaded too last so we can't intercept the necessary calls.
19+
// This means that we were loaded too late so we can't intercept the necessary calls.
2020
// Don't even try in that case.
2121
#define NP_STDIO_ALREADY_LOADED
2222
#include <fcntl.h>
2323
#ifdef _WIN32
24-
#include <windows.h>
24+
#include <wchar.h>
25+
#include <BaseTsd.h>
2526
#define PATH_MAX MAX_PATH
2627
typedef SSIZE_T ssize_t;
2728
#else
@@ -33,7 +34,6 @@ extern "C" {
3334

3435
#ifdef _WIN32
3536
#define _CRTIMP
36-
#include <WinSock2.h>
3737
#endif
3838
#ifndef NUITKAPYTHON_EMBED_BUILD
3939
#define open orig_open
@@ -122,7 +122,8 @@ extern "C" {
122122
#include <stdio.h>
123123
#include <fcntl.h>
124124
#ifdef _WIN32
125-
#include <windows.h>
125+
#include <wchar.h>
126+
#include <BaseTsd.h>
126127
#define PATH_MAX MAX_PATH
127128
typedef SSIZE_T ssize_t;
128129
#else

0 commit comments

Comments
 (0)