summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2019-03-19 18:10:46 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2019-03-19 18:10:46 +0000
commited060c162054affeb91e6f00fa8b0dc5e1e9ca7c (patch)
treebefe94eb464762aa0e7050fdf2f4e36cc6ff41fb
parentbf1f0642ac5a7e2d3984edf03f944513173e471a (diff)
downloadlibapr-ed060c162054affeb91e6f00fa8b0dc5e1e9ca7c.tar.gz
Replace the link-time pragma from r1839494 with APR_DECLARE_LATE_DLL_FUNC
resolution of if_indextoname and if_nametoindex. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1855855 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/arch/win32/apr_arch_misc.h26
-rw-r--r--misc/win32/misc.c6
-rw-r--r--network_io/unix/sockaddr.c1
3 files changed, 28 insertions, 5 deletions
diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h
index 2ee562ec3..bf647e729 100644
--- a/include/arch/win32/apr_arch_misc.h
+++ b/include/arch/win32/apr_arch_misc.h
@@ -47,6 +47,10 @@
#include <tlhelp32.h>
#endif
+#if defined(HAVE_IF_INDEXTONAME) && defined(_MSC_VER)
+#include <Iphlpapi.h>
+#endif
+
struct apr_other_child_rec_t {
apr_pool_t *p;
struct apr_other_child_rec_t *next;
@@ -174,8 +178,9 @@ typedef enum {
DLL_WINSOCKAPI = 2, /* mswsock From WinSock.h */
DLL_WINSOCK2API = 3, /* ws2_32 From WinSock2.h */
DLL_SHSTDAPI = 4, /* shell32 From ShellAPI.h */
- DLL_NTDLL = 5, /* shell32 From our real kernel */
- DLL_defined = 6 /* must define as last idx_ + 1 */
+ DLL_NTDLL = 5, /* ntdll From our real kernel */
+ DLL_IPHLPAPI = 6, /* Iphlpapi From Iphlpapi.h */
+ DLL_defined = 7 /* must define as last idx_ + 1 */
} apr_dlltoken_e;
FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal);
@@ -381,6 +386,23 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, SetDllDirectoryW, 0, (
(lpPathName));
#define SetDllDirectoryW apr_winapi_SetDllDirectoryW
+#ifdef if_nametoindex
+#undef if_nametoindex
+#endif
+APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, NET_IFINDEX, WINAPI, if_nametoindex, 0, (
+ IN PCSTR InterfaceName),
+ (InterfaceName));
+#define if_nametoindex apr_winapi_if_nametoindex
+
+#ifdef if_indextoname
+#undef if_indextoname
+#endif
+APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, PCHAR, NETIOAPI_API_, if_indextoname, 0, (
+ NET_IFINDEX InterfaceIndex
+ PCHAR InterfaceName),
+ (InterfaceIndex, InterfaceName));
+#define if_indextoname apr_winapi_if_indextoname
+
#endif /* !defined(_WIN32_WCE) */
#endif /* ! MISC_H */
diff --git a/misc/win32/misc.c b/misc/win32/misc.c
index 337739ca1..7a80f4fe9 100644
--- a/misc/win32/misc.c
+++ b/misc/win32/misc.c
@@ -139,9 +139,11 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level)
*/
static const char* const lateDllName[DLL_defined] = {
- "kernel32", "advapi32", "mswsock", "ws2_32", "shell32", "ntdll.dll" };
+ "kernel32", "advapi32", "mswsock", "ws2_32", "shell32", "ntdll.dll",
+ "Iphplapi" };
static HMODULE lateDllHandle[DLL_defined] = {
- NULL, NULL, NULL, NULL, NULL, NULL };
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL };
FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal)
{
diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c
index 94b00983b..f3f0f5928 100644
--- a/network_io/unix/sockaddr.c
+++ b/network_io/unix/sockaddr.c
@@ -31,7 +31,6 @@
#if defined(HAVE_IF_INDEXTONAME) && defined(_MSC_VER)
#include <Iphlpapi.h>
-#pragma comment(lib, "Iphlpapi.lib")
#endif
#define APR_WANT_STRFUNC