首页 > 代码库 > 动态链接库DLL

动态链接库DLL

静态链接库的使用方法:

示例代码:http://pan.baidu.com/s/1i303qZV

1.创建工程

技术分享

2.向工程中添加.cpp 和.h

3.头文件代码

#ifdef  MyDLL_API #else#define  MyDLL_API _declspec(dllexport)#endifMyDLL_API int Add(int a,int b);MyDLL_API int Sub(int a,int b);
4.CPP中的代码
#define  MyDLL_API _declspec(dllexport)#include "DLL.h"int Add(int a,int b){	return a+b;}	int Sub(int a,int b){	return a-b;} 
静态链接库的调用:
1.讲.DLL .LIB  .H 复制到工程目录下
2.工程--设置--链接  将.lib文件添加到链接中 多个用空格隔开
3.添加头文件
4.直接使用方法

动态链接库DLL