如何调用DLL中的类
来源:互联网 发布:淘宝客pid三段什么意思 编辑:程序博客网 时间:2024/06/08 00:16
通过 _declspec(dllexport)可以调用DLL中的类,下面是一个简单的例子。
class simple in test.dll
//simple.h
class _declspec(dllexport) simple
{
public:
simple();
void Set(float x, float y) { _x = x; _y = y;}
float Get() { return _x + _y;}
private:
float _x, _y;
};
in caller class
//caller.cpp
#include "simple.h"
#pragma comment(lib, "test.lib")
class _declspec(dllexport)simple;
int main(int argc, char* argv[])
{
simple s;
s.Set(1,1);
float v = s.Get();
return 0;
}
class simple in test.dll
//simple.h
class _declspec(dllexport) simple
{
public:
simple();
void Set(float x, float y) { _x = x; _y = y;}
float Get() { return _x + _y;}
private:
float _x, _y;
};
in caller class
//caller.cpp
#include "simple.h"
#pragma comment(lib, "test.lib")
class _declspec(dllexport)simple;
int main(int argc, char* argv[])
{
simple s;
s.Set(1,1);
float v = s.Get();
return 0;
}
- 如何调用DLL中的类
- MFC如何调用DLL中的类
- 如何动态调用DLL中的导出类
- 如何动态调用DLL中的导出类
- 如何调用DLL中的函数
- 如何调用 DLL 中的函数
- 如何调用DLL中的函数
- 如何调用DLL中的函数
- 如何调用 DLL 中的函数
- C#如何调用C++编写的dll中的导出类
- 如何调用 DLL 中的C++ 类(隐式链接)
- VC中如何调用DLL中的函数
- VC中如何调用DLL中的函数
- VC中如何调用DLL中的函数
- 如何直接调用dll中的函数
- 如何调用dll文件中的函数
- 什么是DLL,如何调用DLL
- 如何在c#中进行调用vc制作的dll中的类
- Java及相关字符集编码问题研究
- DOJO Quick Start
- Fasm---Win32汇编学习8
- 27.5.2 用户页面(main.apsx.cs)
- 如何组建工作室
- 如何调用DLL中的类
- 27.5.3 出错显示页面(err.apsx.cs)
- 转
- HTML DOM -奇怪的childNodes
- 项目经验:在调用LotusScript Arrayunique 函数时会导致Domino 服务器或Notes 客户端宕机
- 27.5.4 测试功能
- Oracle的日期函数
- 27.6 开发实例-订单签名
- 27.6.1 签名页面前台(Sign.aspx)