Skip to content

Load dynamic libraries on Windows and Linux platforms(Windows/Linux加载动态库封装类)

Notifications You must be signed in to change notification settings

HW140701/DynamicModuleLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

1 DynamicModuleLoader

DynamicModuleLoader is a C++ class that can load dynamic libraries on Windows and Linux platforms.

2 How to Use

#include<iostream>

#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;
}

About

Load dynamic libraries on Windows and Linux platforms(Windows/Linux加载动态库封装类)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages