Skip to content

Commit 3665ddb

Browse files
committed
Fix build.
1 parent 5de290f commit 3665ddb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Include/np_embed.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,15 @@ extern "C" {
108108
#define funlockfile orig_funlockfile
109109
#define ftrylockfile orig_ftrylockfile
110110

111+
#ifdef __linux
111112
#define stdin orig_stdin
112113
#define stdout orig_stdout
113114
#define stderr orig_stderr
114115
#endif
116+
#endif
117+
#ifdef __linux
115118
#define _BITS_STDIO_H
119+
#endif
116120
#include <stdio.h>
117121
#include <fcntl.h>
118122
#ifdef _WIN32
@@ -194,9 +198,11 @@ extern "C" {
194198
#undef flockfile
195199
#undef funlockfile
196200
#undef ftrylockfile
201+
#ifdef __linux
197202
#undef stdin
198203
#undef stdout
199204
#undef stderr
205+
#endif
200206

201207
#endif
202208

@@ -270,10 +276,12 @@ typedef struct EFILE_S EFILE;
270276
#endif
271277

272278
NP_DECL(EFILE*) np_fopen(const char* file, const char* mode);
273-
NP_DECL(int) np_open(const char *pathname, int flags, mode_t mode);
274279
#ifdef _WIN32
280+
NP_DECL(int) np_open(const char *pathname, int flags, int mode);
275281
NP_DECL(EFILE*) np_wfopen(const wchar_t *wfile, const wchar_t *mode);
276-
NP_DECL(int) np_wopen(const wchar_t *pathname, int flags, mode_t mode);
282+
NP_DECL(int) np_wopen(const wchar_t *pathname, int flags, int mode);
283+
#else
284+
NP_DECL(int) np_open(const char *pathname, int flags, mode_t mode);
277285
#endif
278286
NP_DECL(int) np_fclose(void* e);
279287
NP_DECL(int) np_close(int fd);
@@ -416,10 +424,12 @@ NP_DECL(int) np_ftrylockfile(void *e);
416424
// Preprocessor Translation
417425
#define FILE EFILE
418426

427+
#ifdef __linux
419428
/* Standard streams. */
420429
extern EFILE *stdin; /* Standard input stream. */
421430
extern EFILE *stdout; /* Standard output stream. */
422431
extern EFILE *stderr; /* Standard error output stream. */
432+
#endif
423433

424434
/* File Opening and Closing */
425435
ALWAYS_INLINE NP_DECL(EFILE*) fopen(const char* file, const char* mode) {

0 commit comments

Comments
 (0)