mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-23 20:11:49 +00:00
Removed DLL interface and Lua conditional
This commit is contained in:
1 parent
639d7a2fd8
commit
4739de6c28
2 files changed
-55
No files matched your search
-40
@@ -100,7 +100,6 @@ typedef unsigned __int64 uint64_t;
|
|||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
typedef SOCKET sock_t;
|
typedef SOCKET sock_t;
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@@ -1317,45 +1316,6 @@ static int mg_open(const char *path, int flag) {
|
|||||||
}
|
}
|
||||||
#endif // _WIN32 && !MONGOOSE_NO_FILESYSTEM
|
#endif // _WIN32 && !MONGOOSE_NO_FILESYSTEM
|
||||||
|
|
||||||
#ifndef MONGOOSE_NO_DL
|
|
||||||
void *mg_open_dll(const char *dll_name) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
wchar_t wbuf[MAX_PATH_SIZE];
|
|
||||||
to_wchar(dll_name, wbuf, ARRAY_SIZE(wbuf));
|
|
||||||
return LoadLibraryW(wbuf);
|
|
||||||
#else
|
|
||||||
return dlopen(dll_name, RTLD_LAZY);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mg_find_dll_sym(void *dll_handle, const char *name) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
return GetProcAddress((HINSTANCE) dll_handle, name);
|
|
||||||
#else
|
|
||||||
return dlsym(dll_handle, name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *mg_load_dll(const char *dll_name, struct mg_dll_symbol *syms) {
|
|
||||||
void *dll_handle;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if ((dll_handle = mg_open_dll(dll_name)) == NULL) {
|
|
||||||
return dll_name;
|
|
||||||
} else {
|
|
||||||
for (i = 0; syms != NULL && syms[i].symbol_name != NULL; i++) {
|
|
||||||
syms[i].symbol_address.ptr = mg_find_dll_sym(dll_handle,
|
|
||||||
syms[i].symbol_name);
|
|
||||||
if (syms[i].symbol_address.ptr == NULL) {
|
|
||||||
return syms[i].symbol_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// A helper function for traversing a comma separated list of values.
|
// A helper function for traversing a comma separated list of values.
|
||||||
// It returns a list pointer shifted to the next value, or NULL if the end
|
// It returns a list pointer shifted to the next value, or NULL if the end
|
||||||
// of the list found.
|
// of the list found.
|
||||||
|
|||||||
-15
@@ -113,21 +113,6 @@ void *mg_start_thread(void *(*func)(void *), void *param);
|
|||||||
char *mg_md5(char buf[33], ...);
|
char *mg_md5(char buf[33], ...);
|
||||||
int mg_authorize_digest(struct mg_connection *c, FILE *fp);
|
int mg_authorize_digest(struct mg_connection *c, FILE *fp);
|
||||||
|
|
||||||
struct mg_dll_symbol {
|
|
||||||
const char *symbol_name;
|
|
||||||
union { void *ptr; void (*func_ptr)(void); } symbol_address;
|
|
||||||
};
|
|
||||||
const char *mg_load_dll(const char *dll_path, struct mg_dll_symbol *symbols);
|
|
||||||
|
|
||||||
// Lua utility functions
|
|
||||||
#ifdef MONGOOSE_USE_LUA
|
|
||||||
#include <lua.h>
|
|
||||||
#include <lauxlib.h>
|
|
||||||
void reg_string(lua_State *L, const char *name, const char *val);
|
|
||||||
void reg_int(lua_State *L, const char *name, int val);
|
|
||||||
void reg_function(lua_State *L, const char *,
|
|
||||||
lua_CFunction, struct mg_connection *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user