1 Star 1 Fork 1

py-zxj-free / dllload

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dlload.cpp 897 Bytes
一键复制 编辑 原始数据 按行查看 历史
py-zxj-free 提交于 2021-05-22 09:48 . 'V1.0'
#include "dlload.h"
#if defined(WIN32)
#include <windows.h>
#endif
#if defined(__linux__)
#include <dlfcn.h>
#endif
MODULE_HANDLE gdl_Open(const char *plname)
{
#if defined(WIN32)
return LoadLibraryA (plname);
#endif
#if defined(__linux__)
return dlopen( plname, RTLD_NOW|RTLD_GLOBAL);
#endif
};
void gdl_Close(MODULE_HANDLE h)
{
if(h)
{
#if defined(WIN32)
FreeLibrary(h);
#endif
#if defined(__linux__)
dlclose (h);
#endif
}
};
void *gdl_GetProc(MODULE_HANDLE h, const char *pfname)
{
if(h)
{
#if defined(WIN32)
return (void *)GetProcAddress(h, pfname);
#endif
#if defined(__linux__)
return dlsym(h,pfname);
#endif
}
return 0;
};
char* gdl_GetLastError()
{
#if defined(WIN32)
return ::GetLastError();
#endif
#if defined(__linux__)
return dlerror();
#endif
}
C++
1
https://gitee.com/pyzxjfree/dllload.git
git@gitee.com:pyzxjfree/dllload.git
pyzxjfree
dllload
dllload
master

搜索帮助