mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
feat: add MinGW cross-compilation support for Windows builds on Linux (#2108)
This commit is contained in:
20
3rd/compat-mingw/dlfcn.c
Normal file
20
3rd/compat-mingw/dlfcn.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "dlfcn.h"
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
void *dlopen(const char *path, int flag) {
|
||||
return LoadLibraryA(path);
|
||||
}
|
||||
|
||||
const char *dlerror() {
|
||||
DWORD err = GetLastError();
|
||||
HLOCAL LocalAddress = NULL;
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, err, 0, (PTSTR)&LocalAddress, 0, NULL);
|
||||
return (LPSTR)LocalAddress;
|
||||
}
|
||||
|
||||
void *dlsym(void *dl, const char *sym) {
|
||||
return GetProcAddress(dl, sym);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user