-*****动态链接库的问题******-
我在有EVC建立一个dll时,用的是WINCE Dynamic-Link Liabrary选项,然后加入类如下:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
//标准模板库和标准收集动态数据分配
#ifndef _AFX_STEMPL_COLL
#define _AFX_STEMPL_COLL
#include <afxtempl.h>
#include <afxcoll.h>
#include "math.h"
#endif
//该头文件定义图像处理宏:
#ifndef __m3d_h_
#ifndef __M3D_H_
#define __m3d_h_
#define __M3D_H_
#ifdef __cplusplus
extern "C" {
/////////////////////////////////////////////////////////////////////////////////
//
// interface for the CVertex3d class.
//
////////////////////////////////////////////////////////////////////////////////
//has included afxcoll.h in the stdafx.h
class __declspec(dllexport) CVertex3d
{
public:
CVertex3d();
CVertex3d(const CVertex3d& vSrc);
virtual ~CVertex3d();
public:
CVertex3d operator = (const CVertex3d& vSrc);
void DefineTopology(const int* pnInFacet, int nNumFacet);
public:
CArray <int,int> m_asIndex;
};
然后编写相应的CPP文件,出现warning如下:
warning C4251: 'm_asIndex' : class 'CArray<int,int>' needs to have dll-interface to be used by clients of class 'CVertex3d'libli
并生成lib和dll文件。生成后新建新工程来引用 库中的类,但是当引用类成员
m_asIndex并向其中增加一个成员时,出现异常,如下:
unhandled exception in xx.exe:0xc00000005 :Access Violation.
对于此问题我是刚摸dll,还请各们大侠指教,定当高分送上,谢谢!!!!!