mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Add ltdl.h shim for Windows
This commit is contained in:
parent
028362d937
commit
8c4ee37dab
43
lib/isc/win32/ltdl.h
Normal file
43
lib/isc/win32/ltdl.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define lt_dlhandle HMODULE
|
||||
#define lt_dlinit() ISC_R_SUCCESS
|
||||
#define lt_dlopen(f) LoadLibraryW(f)
|
||||
#define lt_dlsym(h, s) GetProcAddress(h, s)
|
||||
#define lt_dlclose(h) FreeLibrary(h)
|
||||
|
||||
_Thread_local LPSTR __dlerror_message[1024] = { 0 };
|
||||
|
||||
static const char *
|
||||
lt_dlerror(void) {
|
||||
DWORD errorMessageID = GetLastError();
|
||||
if (errorMessageID == 0) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
LPSTR messageBuffer = NULL;
|
||||
size_t size = FormatMessageA(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPSTR)&messageBuffer, 0, NULL);
|
||||
|
||||
strlcpy(__dlerror_message, messageBuffer, sizeof(__dlerror_message));
|
||||
|
||||
LocalFree(messageBuffer);
|
||||
|
||||
return ((const char *)__dlerror_message);
|
||||
}
|
@ -2031,6 +2031,7 @@
|
||||
./lib/isc/win32/libisc.vcxproj.filters.in X 2013,2014,2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/libisc.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020
|
||||
./lib/isc/win32/libisc.vcxproj.user X 2013,2018,2019,2020
|
||||
./lib/isc/win32/ltdl.h C 2020
|
||||
./lib/isc/win32/meminfo.c C 2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/net.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015,2016,2018,2019,2020
|
||||
./lib/isc/win32/netdb.h C 2000,2001,2004,2006,2007,2009,2013,2016,2018,2019,2020
|
||||
|
Loading…
x
Reference in New Issue
Block a user