- 浏览: 1505129 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (516)
- Java (49)
- Java/Struts 2.0 (25)
- Java/Spring、Spring MVC (11)
- Java/Quartz (3)
- Java/Lucene (6)
- Java/Hibernate (19)
- Java/openJPA (7)
- Java/DWR (7)
- Java/Security、Spring Security/OAuth2 (6)
- Java/Threading (9)
- Java/XML (22)
- java/design pattern (4)
- Android (2)
- JavaScript (46)
- jquery (3)
- DB/MySQL (23)
- DB/Oracle (16)
- PHP (25)
- CSS (20)
- Linux (38)
- C/C++、DLL、Makefile、VC++ (31)
- 正则 (9)
- Eclipse (4)
- 安全、网络等概念 (25)
- 集群 (7)
- 网页 (5)
- 视频\音频 (1)
- HTML (6)
- 计算机数学/算法 (3)
- Virtualbox (1)
- LDAP (2)
- 数据挖掘 (6)
- 工具破解 (1)
- 其他 (13)
- Mail (1)
- 药材 (3)
- 游戏 (2)
- hadoop (13)
- 压力测试 (3)
- 设计模式 (3)
- java/Swing (2)
- 缓存/Memcache (0)
- 缓存/Redis (1)
- OSGI (2)
- OSGI/Gemini (0)
- 文档写作 (0)
- java/Servlet (3)
- MQ/RabbitMQ (2)
- MQ/RocketMQ (0)
- MQ/Kafka (1)
- maven (0)
- SYS/linux (1)
- cache/redis (1)
- DB/Mongodb (2)
- nginx (1)
- postman (1)
- 操作系统/ubuntu (1)
- golang (1)
- dubbo (1)
- 技术管理岗位 (0)
- mybatis-plus (0)
最新评论
-
pgx89112:
大神,请赐我一份这个示例的项目代码吧,万分感谢,1530259 ...
spring的rabbitmq配置 -
string2020:
不使用增强器 怎么弄?
OpenJPA的增强器 -
孟江波:
学习了,楼主,能否提供一份源代码啊,学习一下,十分感谢!!!4 ...
spring的rabbitmq配置 -
eachgray:
...
spring-data-redis配置事务 -
qljoeli:
学习了,楼主,能否提供一份源代码啊,学习一下,十分感谢!!!1 ...
spring的rabbitmq配置
DLL中定义的类可以在应用工程中使用。
下面的例子里,我们在DLL中定义了point和circle两个类,并在应用工程中引用了它们(单击此处下载本工程附件
)。
//文件名:point.h,point类的声明
#ifndef POINT_H
#define POINT_H
#ifdef DLL_FILE
class _declspec(dllexport) point //导出类point
#else
class _declspec(dllimport) point //导入类point
#endif
{
public:
float y;
float x;
point();
point(float x_coordinate, float y_coordinate);
};
#endif
//文件名:point.cpp,point类的实现
#ifndef DLL_FILE
#define DLL_FILE
#endif
#include "point.h"
//类point的缺省构造函数
point::point()
{
x = 0.0;
y = 0.0;
}
//类point的构造函数
point::point(float x_coordinate, float y_coordinate)
{
x = x_coordinate;
y = y_coordinate;
}
//文件名:circle.h,circle类的声明
#ifndef CIRCLE_H
#define CIRCLE_H
#include "point.h"
#ifdef DLL_FILE
class _declspec(dllexport)circle //导出类circle
#else
class _declspec(dllimport)circle //导入类circle
#endif
{
public:
void SetCentre(const point ¢rePoint);
void SetRadius(float r);
float GetGirth();
float GetArea();
circle();
private:
float radius;
point centre;
};
#endif
//文件名:circle.cpp,circle类的实现
#ifndef DLL_FILE
#define DLL_FILE
#endif
#include "circle.h"
#define PI 3.1415926
//circle类的构造函数
circle::circle()
{
centre = point(0, 0);
radius = 0;
}
//得到圆的面积
float circle::GetArea()
{
return PI *radius * radius;
}
//得到圆的周长
float circle::GetGirth()
{
return 2 *PI * radius;
}
//设置圆心坐标
void circle::SetCentre(const point ¢rePoint)
{
centre = centrePoint;
}
//设置圆的半径
void circle::SetRadius(float r)
{
radius = r;
}
类的引用:
#include "..\circle.h" //包含类声明头文件
#pragma comment(lib,"dllTest.lib");
int main(int argc, char *argv[])
{
circle c;
point p(2.0, 2.0);
c.SetCentre(p);
c.SetRadius(1.0);
printf("area:%f girth:%f", c.GetArea(), c.GetGirth());
return 0;
}
从上述源代码可以看出,由于在DLL的类实现代码中定义了宏DLL_FILE,故在DLL的实现中所包含的类声明实际上为:
class _declspec(dllexport) point //导出类point
{
…
}
和
class _declspec(dllexport) circle //导出类circle
{
…
}
而在应用工程中没有定义DLL_FILE,故其包含point.h和circle.h后引入的类声明为:
class _declspec(dllimport) point //导入类point
{
…
}
和
class _declspec(dllimport) circle //导入类circle
{
…
}
发表评论
-
数据结构与算法分析(C语言描述)源代码与答案
2009-12-14 11:44 6683数据结构与算法分析(C语言描述)(第二版) Mark A ... -
A new Michael Jackson song
2009-10-12 16:48 924<!-- [if gte mso 9]><x ... -
makefile 大全
2009-02-24 07:37 1141http://chenl.blogbus.com/logs ... -
Linux_Unix环境下的Make和Makefile详解
2009-02-24 07:35 1293无论是在 Linux 还是在 U ... -
C++的11个注意要点
2009-02-24 07:33 1008C++ 的 11 个注意要点 ... -
运用autoconf和automake自动生成Makefile实例讲解
2009-02-24 07:30 4027运用 autoconf 和 automake ... -
makefile详解(6)
2009-02-24 07:23 1758makefile 详解( 6 ) ... -
makefile详解(5)
2009-02-24 07:22 1643<!-- --><!-- -->& ... -
makefile详解(4)
2009-02-24 07:21 1387<!-- --><!-- -->& ... -
makefile详解(3)
2009-02-24 07:20 1604<!-- --><!-- --> & ... -
makefile详解(2)
2009-02-24 07:19 1293<!-- --><!-- --> & ... -
makefile详解(1)
2009-02-24 07:18 1476makefile 详解 ... -
VC++动态链接库(DLL)编程深入浅出(二) Win32 Dynamic-Link Library
2008-08-19 14:23 7976上节给大家介绍了静态链接库与库的调试与查看( 动态链 ... -
VC++动态链接库(DLL)编程深入浅出(一) Win32 Static Library
2008-08-19 14:13 7086http://www.pconline.com.cn/pced ... -
VC++常用数据类型及其操作详解
2008-08-18 23:43 1334http://blog.csdn.net/flxyzsby/a ... -
VC++数据类型转换大全
2008-08-18 23:25 63892int i = 100; long l = 2001; f ... -
DLL导出变量
2008-08-18 16:20 2035DLL定义的全局变量可以被调用进程访问;DLL也可以访问调用进 ... -
MFC规则DLL 概述
2008-08-18 16:19 2781MFC规则DLL的概念体现在两方面: (1) 它是MFC ... -
MFC规则DLL的创建
2008-08-18 16:18 1816我们来一步步讲述使用MFC向导创建MFC规则DLL的过程,首先 ... -
MFC规则DLL 简单的例子
2008-08-18 16:16 3913这个DLL的例子(属于静态链接到MFC 的规则DLL)中提供了 ...
相关推荐
DLL导出类的三种方法,导出接口类,导出类指针,导出类,不建议使用导出类
MFC扩展DLL导出类 一步一步实现MFC导出类和对话框的例子
一个简单的C++生成DLL(导出类),然后用控制台程序去调用它的示例,可以帮助你理解如何从DLL中导出类,并使用该类。 该项使用VS2010编译,低版本可能无法打开。
通过创建MFC扩展DLL来导出类的方法。
C++DLL中包含一个类,C#端要调用这个类的函数,重新封装这个类,来供C#端调用
本代码为MFCDLL导出类技术调查程序, 程序通过静态DLL导出基类BaseClass和其子类SubClass, 并通过MFC应用程序UseDll.exe调用子类SubClass中的方法 和其继承发父类中的方法,输出相应的值。
编写DLL导出类,将所有DLL的对外接口函数封装
教你首次使用 MFC 扩展DLL(导出类)的Demo
vc在MFC扩展DLL中导出类,可以调用DLL中的类,仅供参考。源代码开源下载。
动态链接库导出类的demo,压缩文件夹中有两个工程,一个是生成dll的工程一个是调用dll的工程,把生成的dll放到test dll的debug文件夹下就可以调用了,工程是用VS2010编写的。
[源码]比较成熟dll导出类示例(包含win32和mfc两种dll以及exe调用示例) 参考codeproject大神链接https://www.codeproject.com/Articles/28969/HowTo-Export-C-classes-from-a-DLL
VC++动态链接库编程深入浅出_DLL导出类.zip
在VC中的DLL类导出以后完全是可以被delphi调用的. 源码中有详细介绍和说明文档.
vc在MFC扩展DLL中导出类,可以学习
本支持库可以调用 DLL 封装的类,vc 与 e 语言的 都支持 非普通方法 取 this 计算 函数地址 然后汇编call。而是通过易语言类的内存特性。。。具体看演示吧。支持库名称及版本:易类神补刀 (1.0#0版)。调用格式: ...