feat: add MinGW cross-compilation support for Windows builds on Linux (#2108)

This commit is contained in:
涵曦
2025-11-26 00:07:43 +08:00
committed by GitHub
parent 5608d39789
commit 234e134967
19 changed files with 3101 additions and 2 deletions

20
3rd/compat-mingw/dlfcn.c Normal file
View 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);
}