Sha256: b7c29a9a7f922d67b0c9aa9570861c89f7e9398266f6bdd93d93bac5ec613ed9
Contents?: true
Size: 910 Bytes
Versions: 63
Compression:
Stored size: 910 Bytes
Contents
diff --git a/src/tds/tls.c b/src/tds/tls.c index 09e7fa0..1da18f6 100644 --- a/src/tds/tls.c +++ b/src/tds/tls.c @@ -101,6 +101,29 @@ #define SSL_PTR BIO_get_data(bio) #endif +/* + * Add a workaround for older Mingw versions without inet_pton(). + * This means RubyInstallers DevKit-4.7.2 in particular. + */ +#if defined(__MINGW32__) && !defined(InetPtonA) + #include <windows.h> + + static HMODULE ws2_32 = NULL; + typedef INT (WINAPI * __inet_pton)(INT Family, LPCWSTR pStringBuf, PVOID pAddr); + static __inet_pton _inet_pton = NULL; + + INT WINAPI inet_pton(INT Family, LPCWSTR pStringBuf, PVOID pAddr) + { + if (_inet_pton == NULL) { + ws2_32 = LoadLibraryEx("Ws2_32.dll", NULL, 0); + + _inet_pton = (__inet_pton)GetProcAddress(ws2_32, "inet_pton"); + } + + return (_inet_pton)(Family, pStringBuf, pAddr); + } +#endif + static SSL_RET tds_pull_func_login(SSL_PULL_ARGS) {
Version data entries
63 entries across 63 versions & 2 rubygems