调用 动态库 实现插件(windows & linux)
1 #include "stdafx.h"
2 typedef int (*PFUN)(int,int);//定义函数指针
3 void main()
4 {
5 HMODULE hModule = ::LoadLibrary("dlltest.dll");//加载dll模块
6 PFUN newfun = (PFUN)::GetProcAddress(hModule,"fun");//函数映射,newfun->fun
7 int i = newfun(1,2);
8 printf("The result is %d\n",i);
9 ::FreeLibrary(hModule);
10 }
http://gauzeehom.iteye.com/blog/1031130
linux 版:http://blog.csdn.net/pathuang68/article/details/4273904