https://github.com/hw140701/dynamicmoduleloader
Load dynamic libraries on Windows and Linux platforms(Windows/Linux加载动态库封装类)
https://github.com/hw140701/dynamicmoduleloader
dynamic-module loader
Last synced: about 1 year ago
JSON representation
Load dynamic libraries on Windows and Linux platforms(Windows/Linux加载动态库封装类)
- Host: GitHub
- URL: https://github.com/hw140701/dynamicmoduleloader
- Owner: HW140701
- Created: 2019-09-25T09:34:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-19T09:40:04.000Z (over 5 years ago)
- Last Synced: 2025-03-22T11:45:03.610Z (about 1 year ago)
- Topics: dynamic-module, loader
- Language: C++
- Homepage:
- Size: 5.86 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 1 DynamicModuleLoader
DynamicModuleLoader is a C++ class that can load dynamic libraries on Windows and Linux platforms.
# 2 How to Use
```cpp
#include
#include "DynamicModuleLoder.h"
typedef int(*Func_Add)(int,int);
int main()
{
DynamicModuleLoder dllLoader;
if (dllLoader.LoadDynamicModule("add.dll"))
{
void* voidTest = dllLoader.GetFunction("Add");
if (voidTest != NULL)
{
Func_Add f_add = (Func_Add )(voidTest );
int ret = f_add(1,2);
std::cout << ret << std::endl;
}
else
{
std::cout << dllLoader.GetErrorMessage() << std::endl;
}
}
else
{
std::cout << dllLoader.GetErrorMessage() << std::endl;
}
dllLoader.UnloadDynamicModule();
getchar();
return 0;
}
```