#include "TADefine.h"#include<list>using namespace std;template <class T>
class TRANSAFC_API CSafeList  
{
public:
CSafeList();
virtual ~CSafeList();
public:
//取得尺寸
int Size(); 
//取出一个元素
BOOL Pop(T& x);
//加入一个元素
void Push(T& x);
//删除全部元素
void Clear();protected:
    list<T> m_List;
CRITICAL_SECTION  m_Lock;
list<T>::iterator m_ite;
};template <class T>
CSafeList<T>::CSafeList()
{
InitializeCriticalSection(&m_Lock);
}
template <class T>
CSafeList<T>::~CSafeList()
{
DeleteCriticalSection(&m_Lock);
}
//取得尺寸
template <class T>
int CSafeList<T>::Size()
{
return m_List.size();
}
//取出一个元素
template <class T>
BOOL CSafeList<T>::Pop(T& x)
{
if(m_List.size() == 0)
return FALSE;
EnterCriticalSection(&m_Lock);
m_ite = m_List.begin();
x = *m_ite;
m_List.pop_front();
LeaveCriticalSection(&m_Lock);
return TRUE;
}
//加入一个元素
template <class T>
void CSafeList<T>::Push(T& x)
{
EnterCriticalSection(&m_Lock);
m_List.push_back(x);
LeaveCriticalSection(&m_Lock);
}
//删除全部元素
template <class T>
void CSafeList<T>::Clear()
{
EnterCriticalSection(&m_Lock);
m_List.clear();
LeaveCriticalSection(&m_Lock);
}//回调函数指针类型
typedef void (*NOTIFYFUNCTION)(PVOID pvData,DWORD dwCode);// This class is exported from the TransAfc.dll
class TRANSAFC_API CTransAfc {
public:
CTransAfc(void);
virtual ~CTransAfc();
    //初始化
int Intialize(LPCSTR pszCommPort,int nBaudRate,NOTIFYFUNCTION fCallBack);
//发送数据
int Send(PVOID pvData,DWORD dwCode);
//清理
int Cleanup();
protected:
//串口通信实例
TCommPort m_Comm;
//序号数组
unsigned short m_SQ[7];
//发送队列IFP
    CSafeList<IFPDATA> m_SendIfpList;
//发送队列AFC
CSafeList<PAFCDATA> m_SendAfcList;
//应答队列
CSafeList<AFCACKPKG> m_AckList;
    //发送线程函数
static DWORD WINAPI SendThread(LPVOID pThis);
//接收线程函数
static DWORD WINAPI RecvThread(LPVOID pThis);
//生成一个包的序号
unsigned short MakeSQ(int nType);
};
编译:
...
transafc.h(133) : warning C4251: 'm_SendIfpList' : class 'CSafeList<struct tagIFPDATA>' needs to have dll-interface to be used by clients of class 'CTransAfc'transafc.h(135) : warning C4251: 'm_SendAfcList' : class 'CSafeList<struct tagAFCDATA *>' needs to have dll-interface to be used by clients of class 'CTransAfc'transafc.h(137) : warning C4251: 'm_AckList' : class 'CSafeList<struct tagAFCACKPKG>' needs to have dll-interface to be used by clients of class 'CTransAfc'
Generating Code...
怎么回事啊?