summaryrefslogtreecommitdiffhomepage
path: root/src/os/win32
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2016-02-04 18:30:21 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2016-02-04 18:30:21 +0300
commit86cc342a26af3aa677d9770dc6a9bcdbd07f5a9e (patch)
tree679e72e4809e5e5641cd697be00cc5f206553aa0 /src/os/win32
parent0f67d6355cb365983820d3c268e25424509b2ef6 (diff)
downloadnginx-86cc342a26af3aa677d9770dc6a9bcdbd07f5a9e.tar.gz
nginx-86cc342a26af3aa677d9770dc6a9bcdbd07f5a9e.tar.bz2
Dynamic modules: dlopen() support.
Diffstat (limited to 'src/os/win32')
-rw-r--r--src/os/win32/ngx_dlopen.c22
-rw-r--r--src/os/win32/ngx_dlopen.h32
2 files changed, 54 insertions, 0 deletions
diff --git a/src/os/win32/ngx_dlopen.c b/src/os/win32/ngx_dlopen.c
new file mode 100644
index 000000000..804f49d13
--- /dev/null
+++ b/src/os/win32/ngx_dlopen.c
@@ -0,0 +1,22 @@
+
+/*
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+char *
+ngx_dlerror(void)
+{
+ u_char *p;
+ static u_char errstr[NGX_MAX_ERROR_STR];
+
+ p = ngx_strerror(ngx_errno, errstr, NGX_MAX_ERROR_STR);
+ *p = '\0';
+
+ return (char *) errstr;
+}
diff --git a/src/os/win32/ngx_dlopen.h b/src/os/win32/ngx_dlopen.h
new file mode 100644
index 000000000..0d6b40524
--- /dev/null
+++ b/src/os/win32/ngx_dlopen.h
@@ -0,0 +1,32 @@
+
+/*
+ * Copyright (C) Maxim Dounin
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_DLOPEN_H_INCLUDED_
+#define _NGX_DLOPEN_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+#define NGX_HAVE_DLOPEN 1
+
+
+#define ngx_dlopen(path) LoadLibrary((char *) path)
+#define ngx_dlopen_n "LoadLibrary()"
+
+#define ngx_dlsym(handle, symbol) (void *) GetProcAddress(handle, symbol)
+#define ngx_dlsym_n "GetProcAddress()"
+
+#define ngx_dlclose(handle) (FreeLibrary(handle) ? 0 : -1)
+#define ngx_dlclose_n "FreeLibrary()"
+
+
+char *ngx_dlerror(void);
+
+
+#endif /* _NGX_DLOPEN_H_INCLUDED_ */