如何用vc编写dll文件
[11-20 17:13:38] 来源:http://www.88dzw.com 嵌入式系统 阅读:8235次
文章摘要:须从新编译。并且,所有所调用的DLL在应用程序加载的同时被加载到内 存中,但应用程序调用的DLL比较多时,装入的过程十分慢。隐式的调用 则在应用程序不知道所要装入的DLL或隐式调用不成功,此时,允许用户 指定所要加载的动态连接库,比较灵活 发信人: dragon (龙), 信区: VC 标 题: 关于VC中的DLL的编程[3] Regular DLL能够被所有支持DLL技术的语言所编写的应用程序 所调用。在这种动态连接库中,它必须有一个从CWinApp继承下来的 类,DllMain函数被MFC所提供,不用自己显式的写出来。下面是一个 例子: // MyRegularDll.h:main hea
如何用vc编写dll文件,标签:嵌入式系统开发,嵌入式开发,http://www.88dzw.com须从新编译。并且,所有所调用的DLL在应用程序加载的同时被加载到内
存中,但应用程序调用的DLL比较多时,装入的过程十分慢。隐式的调用
则在应用程序不知道所要装入的DLL或隐式调用不成功,此时,允许用户
指定所要加载的动态连接库,比较灵活
发信人: dragon (龙), 信区: VC
标 题: 关于VC中的DLL的编程[3]
Regular DLL能够被所有支持DLL技术的语言所编写的应用程序
所调用。在这种动态连接库中,它必须有一个从CWinApp继承下来的
类,DllMain函数被MFC所提供,不用自己显式的写出来。下面是一个
例子:
// MyRegularDll.h:main header file for the MYREGULARDLL DLL
#include "resource.h" // main symbols
class CMyRegularDllApp : public CWinApp
{
public:
CMyRegularDllApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyRegularDllApp)
//}}AFX_VIRTUAL
//{{AFX_MSG(CMyRegularDllApp)
// NOTE - the ClassWizard will add and
// remove member functions here.
// DO NOT EDIT what you see in these blocks
// of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//MyRegularDll.cpp:Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "MyRegularDll.h"
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
BEGIN_MESSAGE_MAP(CMyRegularDllApp, CWinApp)
//{{AFX_MSG_MAP(CMyRegularDllApp)
// NOTE - the ClassWizard will add
// and remove mapping macros here.
// DO NOT EDIT what you see in these blocks
END_MESSAGE_MAP()
////////////////////////////////////////////////////////////
// CMyRegularDllApp construction
CMyRegularDllApp::CMyRegularDllApp()
{
// TOD add construction code here,
// Place all significant initialization in InitInstance
}
以上是AppWizard产生的含有主要代码的两个文件,各位可从中
看出和Non-MFC Dlls的区别。但要注意上面的AppWizard的提醒啊。
发信人: dragon (龙), 信区: VC
标 题: 关于VC中的DLL的编程[4]
发信站: 饮水思源站 (Thu Mar 25 00:46:22 1999) , 站内信件
这次要讲的是最后一种动态连接库:Extension Dlls.再次说明,
Extension Dll只被用MFC类库所编写的应用程序所调用.在这种动态
连接库中,你可以从MFC继承你所想要的、更适于你自己用的类,并
把它提供给你的应用程序。你也可随意的给你的应用程序提供MFC或
MFC继承类的对象指针。
Extension DLLs 和Regular DLLs不一样,它没有一个从CWinApp
继承而来的类的对象,所以,你必须为自己DllMain函数添加初始化
代码和结束代码.如下:
#include "stdafx.h"
#include
static AFX_EXTENSION_MODULE PROJNAMEDLL = { NULL, NULL };
Tag:嵌入式系统,嵌入式系统开发,嵌入式开发,嵌入式系统
- 上一篇:如何用pb编写dll文件
《如何用vc编写dll文件》相关文章
- › 如何用vc编写dll文件
- 在百度中搜索相关文章:如何用vc编写dll文件
- 在谷歌中搜索相关文章:如何用vc编写dll文件
- 在soso中搜索相关文章:如何用vc编写dll文件
- 在搜狗中搜索相关文章:如何用vc编写dll文件
编辑推荐
分类导航
最新更新
热门排行