From 9f4a390258da5dcb94b2d65abb5fa4e0cedae48f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 10 Feb 2020 12:02:37 +0100
Subject: [PATCH] I/O [NT]: Make Pike_NT_* available to the rest of Pike.

NB: As these are mostly variables, they are intentionally NOT
    PMOD_EXPORT as that wouldn't work anyway. Dynamic mosules
    that need these functions will need to look them up by
    themselves.
---
 src/fdlib.c |  3 +--
 src/fdlib.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/fdlib.c b/src/fdlib.c
index 4db672e98c..13d4d4b8a7 100644
--- a/src/fdlib.c
+++ b/src/fdlib.c
@@ -264,8 +264,7 @@ PMOD_EXPORT void set_errno_from_win32_error (unsigned long err)
 
 #undef NTLIBFUNC
 #define NTLIBFUNC(LIB, RET, NAME, ARGLIST)				\
-  typedef RET (WINAPI * PIKE_CONCAT3(Pike_NT_, NAME, _type)) ARGLIST;	\
-  static PIKE_CONCAT3(Pike_NT_, NAME, _type) PIKE_CONCAT(Pike_NT_, NAME)
+  PIKE_CONCAT3(Pike_NT_, NAME, _type) PIKE_CONCAT(Pike_NT_, NAME)
 
 #include "ntlibfuncs.h"
 
diff --git a/src/fdlib.h b/src/fdlib.h
index 04ce2a5ac8..7d5c301e4e 100644
--- a/src/fdlib.h
+++ b/src/fdlib.h
@@ -327,6 +327,17 @@ extern int fd_type[FD_SETSIZE];
 #define S_IFIFO 0010000
 #endif
 
+/* Make dynamically loaded functions available to the rest of pike. */
+#undef NTLIB
+#define NTLIB(LIB)
+
+#undef NTLIBFUNC
+#define NTLIBFUNC(LIB, RET, NAME, ARGLIST)				\
+  typedef RET (WINAPI * PIKE_CONCAT3(Pike_NT_, NAME, _type)) ARGLIST;	\
+  extern PIKE_CONCAT3(Pike_NT_, NAME, _type) PIKE_CONCAT(Pike_NT_, NAME)
+
+#include "ntlibfuncs.h"
+
 
 /* This may be inaccurate! /Hubbe */
 #if defined(__NT__) && !defined(__MINGW32__)
-- 
GitLab