vs2010下编译DLL库和使用
来源:互联网 发布:dice-51单片机开发系统 编辑:程序博客网 时间:2024/06/12 21:21
一、创建DLL 文件
1 vs2010下选择win32应用程序,创建DLL 工程
2 创建头文件testdll.h
#ifndef TestDll_H_#define TestDll_H_#ifdef MYLIBDLL#define MYLIBDLL extern "C" _declspec(dllimport) #else#define MYLIBDLL extern "C" _declspec(dllexport) #endifMYLIBDLL int Add(int plus1, int plus2);//You can also write like this://extern "C" {//_declspec(dllexport) int Add(int plus1, int plus2);//};#endif
3 创建源文件
#include "stdafx.h"#include "testdll.h"#include <iostream>using namespace std;int Add(int plus1, int plus2){int add_result = plus1 + plus2;return add_result;}4 创建模块文件
LIBRARY "MyDLL"EXPORTSAdd @15 选择release版本进行编译
二、调用DLL文件中的函数
#include "stdafx.h"#include <windows.h>#include <stdio.h>#pragma comment (lib , "MyDll.lib" )extern "C"_declspec (dllimport) int Add(int plus1, int plus2);int _tmain(int argc, _TCHAR* argv[]){printf("%d\n",Add(6,4));return 0;}
0 0
- vs2010下编译DLL库和使用
- win7下vs2010编译生成sqlite3.dll库
- VS2010下 DLL的创建和使用总结
- vs2010下C++调用DLL以及怎么生成DLL和为什么使用DLL
- VS2010创建DLL和使用DLL
- vs2010下编译使用boost
- 使用vs2010 创建dll和引用dll在有一个解决方案下
- mingw 下编译的libx264 DLL 如何在vs2010里使用
- vs2010创建和使用动态链接库DLL和lib
- 在 VS2008 / VS2010 下编译和使用 sqlite3
- 在 VS2008 / VS2010 下编译和使用 sqlite3
- 在VS2010下编译和使用tesseract_ocr识别验证码
- 在VS2010下编译和使用tesseract_ocr识别验证码
- VS2010下 VLC axvlc.dll 使用
- VS2010编写动态链接库dll、使用dll 和 调试dll
- VS2010下编译的库在VC6下使用问题
- Win7_64位系统下,使用VS2010编译stlport库和Boost库
- vs2010创建和使用动态链接库(dll)
- ant配置与使用
- word文档结构图混乱
- 输入年份和天数计算日期
- vi 的常用快捷命令
- Arm-Linux根文件系统网络配置小结
- vs2010下编译DLL库和使用
- 显示Intent,隐式Intent
- 【Oracle】物理DATAGUARD最大性能模式部署
- libgdx基础教程——TTF字库的使用
- 程序媛的悲催面试经历
- Visual Studio 跨平台开发实战(4) - Xamarin Android 基本控制项介绍
- 图像处理中色调、亮度、饱和度的定义
- android面试题 不单单为了面试也是一次很好的学习
- log4j日志学习笔记