老是记不清dll调用的一些东西,作此简单笔记。
1. 隐式调用
需要头文件和lib,讲lib拷贝到工程目录下
#include "*.h"
or
#include “*.h”
#pragma comment(lib,"*.lib")
如果没有头文件,则需要对用到的函数进行声明:
extern void func(char*); //声明外部定义
// _declspec(dllimport) void func(int a,int b); //申明是从DLL里面调用
2. 显式调用
只需要dll文件即可,
主要使用 LoadLibrary & GetProcAddress 以及 FreeLibrary
关于动态链接库,显式导出类有一下几篇博客参考:
http://blog.youkuaiyun.com/maxttyl/article/details/1537023
http://luwenjie0904.blog.163.com/blog/static/96561541201131383951633/
http://hi.baidu.com/lo_hoso/item/c15cbf0e4e76c2133a53eebe