动态链接库学习-2
2014-03-25 21:53
246 查看
//模块定义文件的使用
//建立动态链接库
//dll2.cpp
int add(int a,int b)
{
return a+b;
}
int sub(int a,int b)
{
return a-b;
}
//建立一个txt文本文件,后缀名改成*.def
//在该工程中加入该文件,
//dll2.def
LIBRARY dll2
EXPORTS
add
sub
//建立测试工程
//将生成的dll,和lib文件加入到该工程中。
//dll2call.cpp
#include
using namespace std;
#include
void main()
{
typedef int (*pfun) (int ,int);
HINSTANCE hdll;
hdll=LoadLibrary("dll2.dll");
pfun p1;
p1=(pfun)GetProcAddress(hdll,"add");
cout<<p1(3,5)<<endl;
}
//建立动态链接库
//dll2.cpp
int add(int a,int b)
{
return a+b;
}
int sub(int a,int b)
{
return a-b;
}
//建立一个txt文本文件,后缀名改成*.def
//在该工程中加入该文件,
//dll2.def
LIBRARY dll2
EXPORTS
add
sub
//建立测试工程
//将生成的dll,和lib文件加入到该工程中。
//dll2call.cpp
#include
using namespace std;
#include
void main()
{
typedef int (*pfun) (int ,int);
HINSTANCE hdll;
hdll=LoadLibrary("dll2.dll");
pfun p1;
p1=(pfun)GetProcAddress(hdll,"add");
cout<<p1(3,5)<<endl;
}
相关文章推荐
- 动态链接库基础学习一
- 动态链接库的初步学习
- 编译、链接学习笔记(五)动态链接
- 动态链接库学习
- JavaScript精简学习4(动态表单和链接处理)
- 动态链接库基础学习二
- LR学习笔记八 之 初识LR动态链接库
- NDK学习笔记:动态链接库与静态链接库的基本使用流程简记
- Linux入门学习-gcc编译器与静态动态链接_第五章
- 【JNI调用DLL动态库】Java使用JNI调用DLL动态链接库学习记录
- COM 技术内幕学习之五 (动态链接)
- [NOTE] Windows&Linux动态链接库学习笔记
- 关于动态链接学习中的小结
- 动态链接库创建与使用(学习笔记) .
- 一些自己学习的html代码(锚,动态改变文本和链接,有序无序列表等)
- 动态链接库学习札记
- 动态链接库的简单应用和学习
- 动态链接库创建与使用(学习笔记)
- 动态链接库的学习总结
- 学习 gcc编译器使用3 生成动态链接