aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-04 00:16:32 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-09-02 04:09:46 +1000
commit5c8fd3906e6bac0914c6968a33719cc1bf5cdbf0 (patch)
treea2e413b6662beec70a9267eaecbfc6e41fdcae32
parent341ee79a01307dd15a2f3b883745fa6c5072e033 (diff)
downloadluaossl-5c8fd3906e6bac0914c6968a33719cc1bf5cdbf0.tar.gz
luaossl-5c8fd3906e6bac0914c6968a33719cc1bf5cdbf0.tar.bz2
luaossl-5c8fd3906e6bac0914c6968a33719cc1bf5cdbf0.zip
Implement dl_anchor for win32
-rw-r--r--src/openssl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index b51ae03..9c87bc9 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -1342,7 +1342,15 @@ static const EVP_MD *auxL_optdigest(lua_State *L, int index, EVP_PKEY *key, cons
*/
/* dl_anchor must not be called from multiple threads at once */
static int dl_anchor(void) {
-#if HAVE_DLADDR
+#if _WIN32
+ EXPORT extern int luaopen__openssl(lua_State *);
+
+ HMODULE dummy;
+ if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN|GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (void *)&luaopen__openssl, &dummy))
+ return GetLastError();
+
+ return 0;
+#elif HAVE_DLADDR
extern int luaopen__openssl(lua_State *);
static void *anchor;
Dl_info info;