mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
21 lines
524 B
C
21 lines
524 B
C
#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);
|
|
}
|
|
|