首页 新闻 会员 周边 捐助

怎么把c++头文件编译成dll文件

0
悬赏园豆:100 [已解决问题] 解决于 2017-09-11 09:28
  1 #ifndef __SYMLINK_API_H_INCLUDED__
  2 #define __SYMLINK_API_H_INCLUDED__ 
  3 #ifdef __cplusplus
  4 
  5 #define SYMAPI_STATUS_OK            0
  6 //初始状态
  7 #define SYMAPI_STATUS_NOCONNECT        1
  8 //连接断开
  9 #define SYMAPI_STATUS_DISCONNECT    2
 10 //连接中
 11 #define SYMAPI_STATUS_CONNECTING    3
 12 //连接成功
 13 #define SYMAPI_STATUS_CONNECTED        4
 14 //发送登录命令
 15 #define SYMAPI_STATUS_LOGIN            5
 16 //登录正常
 17 #define SYMAPI_STATUS_LOGIN_OK        6
 18 //登录失败(LastErr获取原因)
 19 #define SYMAPI_STATUS_LOGIN_FAIL    7
 20 //读取数据库点
 21 #define SYMAPI_STATUS_REQCONFIG        8
 22 //读取数据库点正常
 23 #define SYMAPI_STATUS_REQCONFIG_OK    9
 24 //读取数据库点失败
 25 #define SYMAPI_STATUS_REQCONFIG_FAIL 10
 26 //总召唤
 27 #define SYMAPI_STATUS_REQALL        11
 28 //总召唤正常
 29 #define SYMAPI_STATUS_REQALL_OK        12
 30 //总召唤失败
 31 #define SYMAPI_STATUS_REQALL_FAIL    13
 32 //数据库版本发生变化
 33 #define SYMAPI_STATUS_VER            14
 34 //有断线缓存数据
 35 #define SYMAPI_STATUS_TX            15
 36 
 37 #define SYMAPI_ERR_OK                0
 38 //命令超时
 39 #define SYMAPI_ERR_TIMEOUT            -1
 40 //解压缩失败
 41 #define SYMAPI_ERR_UNCOMPRESS        -2
 42 //数据版本改变
 43 #define SYMAPI_ERR_VER                -3
 44 //未连接
 45 #define SYMAPI_ERR_CONNECT            -4
 46 //未完成初始化
 47 #define SYMAPI_ERR_INIT                -5
 48 //数据未找到
 49 #define SYMAPI_ERR_FIND                -6
 50 //参数错误
 51 #define SYMAPI_ERR_PARAM            -7
 52 //调用队列溢出
 53 #define SYMAPI_ERR_CMDBUF            -8
 54 //调用超时
 55 #define SYMAPI_ERR_CMDTIME            -9
 56 //调用返回错误
 57 #define SYMAPI_ERR_CMDERR            -10
 58 //功能被禁止
 59 #define SYMAPI_ERR_DISABLE            -11
 60 
 61 
 62 //用户登录失败
 63 #define SYMAPI_ERR_LOGIN_FAIL        -1000
 64 //用户不存在
 65 #define SYMAPI_ERR_LOGIN_USER        -1001
 66 //密码错误
 67 #define SYMAPI_ERR_LOGIN_PASS        -1002
 68 //用户禁止
 69 #define SYMAPI_ERR_LOGIN_INV        -1003
 70 //限制登录
 71 #define SYMAPI_ERR_LOGIN_DIS        -1004
 72 //重复登录
 73 #define SYMAPI_ERR_LOGIN_RE            -1009
 74 //操作需要用户先登录
 75 #define SYMAPI_ERR_LOGIN_NULL        -1090
 76 //版本不一致,需要更新API
 77 #define SYMAPI_ERR_LOGIN_VER        -1100
 78 // 历史查询错误码
 79 #define QUERY_TASKID_ERROR            -10070                /*!< TagID太大,比系统初始化时最大的TagID还大 */
 80 #define QUERY_TYPE_ERROR            -10071                /*!< 查询类型错误 */
 81 #define QUERY_TIME_ERROR            -10072                /*!< 查询时间错误 */
 82 #define TAGID_NOT_EXIST                -10073                /*!< 查询时间错误 */
 83 #define TAGID_ALREADY_EXIST            -10074                /*!< 查询时间错误 */
 84 #define TAG_COUNT_BIGGER            -10075                /*!< 查询时间错误 */
 85 #define TAGID_BIGGER                -10076                /*!< 查询时间错误 */
 86 #define QUERY_DATA_EMPTY            -10077                /*!< 被查询点没有数据 */
 87 #define QUERY_TAGID_NOTFOUND        -10078
 88 
 89 //获取所有信息包括点和组
 90 #define SYMAPI_INFO_TYPE_ALL        0
 91 //获取所有组信息
 92 #define SYMAPI_INFO_TYPE_GROUP        1
 93 //获取自身的点和组
 94 #define SYMAPI_INFO_TYPE_SELF        2
 95 
 96 #define SYMAPI_DBTAGTYPE_NONE        0
 97 #define SYMAPI_DBTAGTYPE_INT        1
 98 #define SYMAPI_DBTAGTYPE_DOUBLE        2
 99 #define SYMAPI_DBTAGTYPE_STR        3
100 #define SYMAPI_DBTAGTYPE_BLOCK        4
101 #define SYMAPI_DBTAGTYPE_EVENT        5
102 
103 #include <math.h>
104 #define DOUBLE_DATAMIN                0.00000001
105 
106 //开辟内存
107 char* SymLinkApiMallocMem(size_t Len);
108 //释放内存
109 void SymLinkApiFreeMem(char* pBuf);
110 
111 #pragma pack(push,1)
112 
113 struct SymLinkApiString
114 {
115     SymLinkApiString();
116     ~SymLinkApiString();
117     //
118     SymLinkApiString(const SymLinkApiString& obj);
119     SymLinkApiString& operator=(const SymLinkApiString& obj);
120     SymLinkApiString& operator=(const char* pData);
121     operator const char *() const; 
122     //
123     void Clear();
124     const char *GetStr() const;
125     //
126     size_t nLen;
127     char *pBuf;
128 };
129 
130 struct CDbCommSOE
131 {
132     CDbCommSOE();
133     ~CDbCommSOE();
134     void Clear();
135 
136     long        m_nSrc;            //0-采集,1-冗余节点
137     long        m_hRtdbTagHandle;
138 
139     //
140     int            m_nKind;
141 
142     int            m_nValue;        //动作值
143     SymLinkApiString        m_csActItem;    //动作项,为空时用点描述代替
144     SymLinkApiString        m_csRData1;        //相关数据
145     SymLinkApiString        m_csRData2;        //相关数据
146     long            m_nReasonCode;    //动作原因
147     SymLinkApiString        m_csReason;        //动作原因
148 };
149 
150 struct TDB_BLOCK
151 {
152     int        m_nFormat;    //0-二进制,1-ASC码
153     int        m_nFlag;    //预留,程序员灵活使用    
154     int        m_nHeaderLen; // 头部长度
155     unsigned char*    m_pHeaderData; // 头部数据
156     int        m_nDataLen; // 数据长度
157     unsigned char*    m_pData; // 数据部分
158     SymLinkApiString m_csDesc; // 描述
159 };
160 
161 struct CDbCommBlock  
162 {
163     CDbCommBlock();
164     ~CDbCommBlock();
165     CDbCommBlock& operator=(const CDbCommBlock&);
166     CDbCommBlock(const CDbCommBlock&);
167 
168     void Clear();
169 
170     long        m_nSrc;                //0-采集,1-冗余节点 //没有用到
171     long        m_hRtdbTagHandle;    //数据handle
172     long        m_nHisKey;            //Key //没有用到
173 
174     //
175     TDB_BLOCK    m_tBlock;    
176 };
177 
178 //数据类型定义
179 struct SymLinkApiData
180 {
181 public:
182     SymLinkApiData();
183     SymLinkApiData(const SymLinkApiData& src);
184     ~ SymLinkApiData();
185     //
186     SymLinkApiData& operator=(int nData);
187     SymLinkApiData& operator=(double dbData);
188     SymLinkApiData& operator=(const char* pData);
189     SymLinkApiData& operator=(const CDbCommSOE* pSOE);
190     SymLinkApiData& operator=(const CDbCommBlock* pBlock);
191     SymLinkApiData& operator=(const SymLinkApiData& src);
192     operator int() const; 
193     operator double() const; 
194     operator const char *() const; 
195     //
196     void Clear();
197     bool CompData(const SymLinkApiData& src) const;
198     int GetInt();
199     double GetDouble();
200     const char *GetStr();
201     //
202     unsigned char Type;
203     int        nTime;
204     short    nTimeMills;
205     short    nFlag;
206     int        nQuality;
207     union {
208         int nData;
209         struct {char *pBuf;
210                size_t nLen;
211         }strData;
212         struct {void *pBuf;
213                size_t nLen;
214         }binData;
215         double dbData;
216         CDbCommSOE* pSOEData;
217         CDbCommBlock* pBlockData;
218     }Data;
219 };
220 
221 #pragma pack(pop)
222 
223 
224 inline SymLinkApiString::SymLinkApiString()
225 {
226     pBuf = NULL;
227     nLen = 0;
228 }
229 
230 inline SymLinkApiString::~SymLinkApiString()
231 {
232     Clear();
233 }
234 
235 inline SymLinkApiString::SymLinkApiString(const SymLinkApiString& obj)
236 {
237     pBuf = NULL;
238     nLen = 0;
239     *this = obj.GetStr();
240 }
241 
242 inline SymLinkApiString& SymLinkApiString::operator =(const SymLinkApiString& obj)
243 {
244     *this = obj.GetStr();
245     return *this;
246 }
247 
248 inline SymLinkApiString& SymLinkApiString::operator=(const char *pData)
249 {
250     Clear();
251     if (pData != NULL)
252     {
253         nLen = strlen(pData);
254         pBuf = SymLinkApiMallocMem(nLen+1);
255         strcpy(pBuf, pData);
256     }
257     return *this;
258 }
259 
260 inline SymLinkApiString::operator const char *() const
261 {
262     if (pBuf != NULL)
263         return pBuf;
264     return "";
265 }
266 
267 inline void SymLinkApiString::Clear()
268 {
269     if (pBuf != NULL)
270         SymLinkApiFreeMem(pBuf);
271     pBuf = NULL;
272     nLen = 0;
273 }
274 
275 inline const char* SymLinkApiString::GetStr() const
276 {
277     return *this;
278 }
279 
280 CDbCommSOE* SymLinkApiMallocSOE();
281 void SymLinkApiFreeSOE(CDbCommSOE* pSOE);
282 
283 inline CDbCommSOE::CDbCommSOE()
284     : m_nSrc(0),
285     m_hRtdbTagHandle(0),
286     m_nKind(0),
287     m_nValue(0),
288     m_nReasonCode(0)
289 {
290 }
291 
292 inline CDbCommSOE::~CDbCommSOE()
293 {
294     Clear();
295 }
296 
297 inline void CDbCommSOE::Clear() {
298 }
299 
300 CDbCommBlock* SymLinkApiMallocBlock();
301 void SymLinkApiFreeBlock(CDbCommBlock* pBlock);
302 
303 inline CDbCommBlock::CDbCommBlock()
304     : m_nSrc(0),
305     m_hRtdbTagHandle(0),
306     m_nHisKey(0)
307 {
308     memset(&m_tBlock, 0, sizeof(TDB_BLOCK));
309 }
310 
311 inline CDbCommBlock::~CDbCommBlock()
312 {
313     Clear();
314 }
315 
316 inline CDbCommBlock& CDbCommBlock::operator=(const CDbCommBlock& obj)
317 {
318     Clear();
319     m_nSrc = obj.m_nSrc;
320     m_hRtdbTagHandle = obj.m_hRtdbTagHandle;
321     m_nHisKey = obj.m_nHisKey;
322     m_tBlock = obj.m_tBlock;
323 
324     int nLen = m_tBlock.m_nDataLen;
325     if (nLen > 0)
326     {
327         m_tBlock.m_pData = 
328             (unsigned char*)SymLinkApiMallocMem(nLen);
329         memcpy(m_tBlock.m_pData, obj.m_tBlock.m_pData, nLen);
330     }
331 
332     nLen = m_tBlock.m_nHeaderLen;
333     if (nLen > 0)
334     {
335         m_tBlock.m_pHeaderData =
336             (unsigned char*)SymLinkApiMallocMem(nLen);
337         memcpy(m_tBlock.m_pHeaderData, obj.m_tBlock.m_pHeaderData, nLen);
338     }
339     return *this;
340 }
341 inline CDbCommBlock::CDbCommBlock(const CDbCommBlock& obj)
342     : m_nSrc(obj.m_nSrc),
343     m_hRtdbTagHandle(obj.m_hRtdbTagHandle),
344     m_nHisKey(obj.m_nHisKey)
345 {
346     memset(&m_tBlock, 0, sizeof(TDB_BLOCK));
347     *this = obj;
348 }
349 inline void CDbCommBlock::Clear()
350 {
351     if (m_tBlock.m_pData)
352         SymLinkApiFreeMem((char*)m_tBlock.m_pData);
353     if (m_tBlock.m_pHeaderData)
354         SymLinkApiFreeMem((char*)m_tBlock.m_pHeaderData);
355 }
356 inline SymLinkApiData::SymLinkApiData()
357 {
358     nTime = nTimeMills = nFlag = nQuality = 0;
359     Type = SYMAPI_DBTAGTYPE_NONE;
360     memset(&Data,0,sizeof(Data));
361 }
362 
363 inline SymLinkApiData::SymLinkApiData(const SymLinkApiData& src)
364 {
365     nTime = nTimeMills = nFlag = nQuality = 0;
366     Type = SYMAPI_DBTAGTYPE_NONE;
367     memset(&Data,0,sizeof(Data));
368     *this = src;
369 }
370 
371 inline SymLinkApiData::~SymLinkApiData()
372 {
373     Clear();
374 }
375 
376 inline SymLinkApiData& SymLinkApiData::operator=(int nData)
377 {
378     Clear();
379     Type = SYMAPI_DBTAGTYPE_INT;
380     Data.nData = nData;
381     return *this;
382 }
383 
384 inline SymLinkApiData& SymLinkApiData::operator=(double dbData)
385 {
386     Clear();
387     Type = SYMAPI_DBTAGTYPE_DOUBLE;
388     Data.dbData = dbData;
389     return *this;
390 }
391 
392 inline SymLinkApiData& SymLinkApiData::operator=(const char *pData)
393 {
394     Clear();
395     if (pData != NULL)
396     {
397         Type = SYMAPI_DBTAGTYPE_STR;
398         Data.strData.nLen = strlen(pData);
399         Data.strData.pBuf = SymLinkApiMallocMem(Data.strData.nLen+1);
400         strcpy(Data.strData.pBuf, pData);
401     }
402     return *this;
403 }
404 
405 inline SymLinkApiData& SymLinkApiData::operator=(const CDbCommSOE *pSOE)
406 {
407     Clear();
408     if (pSOE != NULL)
409     {
410         Type = SYMAPI_DBTAGTYPE_EVENT;
411         Data.pSOEData = SymLinkApiMallocSOE();
412         *Data.pSOEData = *pSOE;
413     }
414     return *this;
415 }
416 inline SymLinkApiData& SymLinkApiData::operator=(const CDbCommBlock *pBlock)
417 {
418     Clear();
419     if (pBlock != NULL)
420     {
421         Type = SYMAPI_DBTAGTYPE_BLOCK;
422         Data.pBlockData = SymLinkApiMallocBlock();
423         *Data.pBlockData = *pBlock;
424     }
425     return *this;
426 }
427 inline SymLinkApiData& SymLinkApiData::operator=(const SymLinkApiData& src)
428 {
429     Clear();
430     this->Type = src.Type;
431     this->nTime = src.nTime;
432     this->nTimeMills = src.nTimeMills;
433     this->nFlag = src.nFlag;
434     this->nQuality = src.nQuality;
435     if (src.Type == SYMAPI_DBTAGTYPE_INT)
436     {
437         *this = src.Data.nData;
438     }
439     else if (src.Type == SYMAPI_DBTAGTYPE_DOUBLE)
440     {
441         *this = src.Data.dbData;
442     }
443     else if (src.Type == SYMAPI_DBTAGTYPE_STR)
444     {
445         *this = src.Data.strData.pBuf;
446     }
447     else if (src.Type == SYMAPI_DBTAGTYPE_BLOCK)
448     {
449         *this =src.Data.pBlockData;
450     }
451     else if(src.Type == SYMAPI_DBTAGTYPE_EVENT)
452     {
453         *this = src.Data.pSOEData;
454     }
455     return *this;
456 }
457 
458 inline SymLinkApiData::operator int() const
459 {
460     if (Type == SYMAPI_DBTAGTYPE_INT)
461     {
462         return Data.nData;
463     }
464     else if (Type == SYMAPI_DBTAGTYPE_DOUBLE)
465     {
466         return int(Data.dbData);
467     }
468     else if (Type == SYMAPI_DBTAGTYPE_STR)
469     {
470         if (Data.strData.pBuf != NULL)
471             return atol(Data.strData.pBuf);
472     }
473     return 0;
474 }
475 
476 inline SymLinkApiData::operator double() const
477 {
478     if (Type == SYMAPI_DBTAGTYPE_INT)
479     {
480         return Data.nData;
481     }
482     else if (Type == SYMAPI_DBTAGTYPE_DOUBLE)
483     {
484         return Data.dbData;
485     }
486     else if (Type == SYMAPI_DBTAGTYPE_STR)
487     {
488         if (Data.strData.pBuf != NULL)
489             return atof(Data.strData.pBuf);
490     }
491     return 0;
492 }
493 
494 inline SymLinkApiData::operator const char *() const
495 {
496     if (Type == SYMAPI_DBTAGTYPE_STR)
497     {
498         if (Data.strData.pBuf != NULL)
499             return Data.strData.pBuf;
500     }
501     return "";
502 }
503 
504 inline void SymLinkApiData::Clear()
505 {
506     if ((Type == SYMAPI_DBTAGTYPE_STR) && (Data.strData.pBuf != 0))
507     {
508         SymLinkApiFreeMem(Data.strData.pBuf);
509         Data.strData.pBuf = NULL;
510         Data.strData.nLen = 0;
511     }
512     if (Type == SYMAPI_DBTAGTYPE_BLOCK) {
513         SymLinkApiFreeBlock(Data.pBlockData);
514     }
515     if (Type == SYMAPI_DBTAGTYPE_EVENT) {
516         SymLinkApiFreeSOE(Data.pSOEData);    
517     }
518     Type = SYMAPI_DBTAGTYPE_NONE;
519 }
520 
521 inline bool SymLinkApiData::CompData(const SymLinkApiData& src) const
522 {
523     if (Type == SYMAPI_DBTAGTYPE_INT)
524     {
525         if (src.Type == SYMAPI_DBTAGTYPE_INT)
526         {
527             return Data.nData==src.Data.nData;
528         }
529         else if (src.Type == SYMAPI_DBTAGTYPE_DOUBLE)
530         {
531             return fabs(Data.nData - src.Data.dbData) <= DOUBLE_DATAMIN;
532         }
533     }
534     else if (Type == SYMAPI_DBTAGTYPE_DOUBLE)
535     {
536         if (src.Type == SYMAPI_DBTAGTYPE_INT)
537         {
538             return fabs(Data.dbData - src.Data.nData) <= DOUBLE_DATAMIN;
539         }
540         else if (src.Type == SYMAPI_DBTAGTYPE_DOUBLE)
541         {
542             return fabs(Data.dbData - src.Data.dbData) <= DOUBLE_DATAMIN;
543         }
544     }
545     else if (Type == SYMAPI_DBTAGTYPE_STR)
546     {
547         if (src.Type == SYMAPI_DBTAGTYPE_STR)
548         {
549             const char *pDesc = (Data.strData.pBuf)?(Data.strData.pBuf):"";
550             const char *pSrc = (src.Data.strData.pBuf)?(src.Data.strData.pBuf):"";
551             return strcmp(pDesc,pSrc) == 0;
552         }
553     }
554     else if (Type == SYMAPI_DBTAGTYPE_EVENT || Type == SYMAPI_DBTAGTYPE_BLOCK)
555     {
556         return false;
557     }
558     return false;
559 }
560  
561 inline int SymLinkApiData::GetInt()
562 {
563     return *this;
564 }
565 
566 inline double SymLinkApiData::GetDouble()
567 {
568     return *this;
569 }
570 
571 inline const char* SymLinkApiData::GetStr()
572 {
573     return *this;
574 }
575 
576 //函数指针定义
577 typedef void (*STATUS_CHANGE_FUNC)(void* ptr1,        //ptr1指向本对象的指针
578                                     void* ptr2,        //ptr2指向调用者的指针
579                                     int nStatus        //组件状态
580 );
581 
582 typedef void (*DATA_CHANGE_FUNC)(void* ptr1,        //ptr1指向本对象的指针
583                                     void* ptr2,        //ptr2指向调用者的指针
584                                     int nChangeCount, //点变化个数
585                                     int *pChangeHandle//变化的点ID
586 );
587 
588 //
589 class  CSymLinkApi 
590 {
591 public:
592     CSymLinkApi();
593     ~CSymLinkApi();
594     //传入调用者指针
595     virtual  void   SetCallerPtr(void* ptr)=0;
596     //设置状态变化时的回调函数
597     virtual void  SetStatusChangeFunc(STATUS_CHANGE_FUNC hFuncc) = 0;
598     //设置数据变化后的回调函数
599     virtual void  SetDataChangeFunc(DATA_CHANGE_FUNC hFunc) = 0;
600     //设置数据变化缓存(nStatus = 0时关闭变化缓存功能)
601     virtual void  SetChangeBufStatus(int nStatus) = 0;
602     //设置断线缓存(nStatus = 0时关闭断线缓存功能)
603     virtual void   SetTxSaveBufStatus(int nStatus) = 0;
604     //获取心跳时间
605     virtual int  GetPackTimeOut() = 0;
606     //设置心跳时间
607     virtual void  SetPackTimeOut(int nTimeout) = 0;
608     //获取链路超时时间
609     virtual int  GetLinkTimeOut() = 0;
610     //设置链路超时时间
611     virtual void  SetLinkTimeOut(int nTimeout) = 0;    
612     //获取命令超时时间
613     virtual int  GetCmdTimeOut() = 0;
614     //设置命令超时时间
615     virtual void  SetCmdTimeOut(int nTimeout) = 0;    
616     //获取总召时间
617     virtual int  GetCallAllTimeOut() = 0;
618     //设置总召时间
619     virtual void  SetCallAllTimeOut(int nTimeout) = 0;    
620     //连接服务器
621     virtual bool  ConnectServer(const char* lpServerIP, int nPort, const char *lpUser, const char *lpPass, int nType) = 0;
622     //断开连接
623     virtual void  DisConnect() = 0;
624     //得到状态
625     virtual int  GetStatus() = 0;
626     //得到错误信息
627     virtual int  GetLastErr() = 0;
628     //得到数据版本信息
629     virtual int  GetDbVersion(int& nVer) = 0;
630     //获取数据库信息
631     virtual int  GetDbInfo(const char *lpRoot, int nType, SymLinkApiString& dbInfo) = 0;
632     //获取数据库点信息
633     virtual int  GetDbTagInfoByHandle(int nHandle, SymLinkApiString& tagInfo) = 0;
634     virtual int  GetDbTagInfoByName(const char *lpName, SymLinkApiString& tagInfo) = 0;
635     //获取数据库点信息
636     virtual int  GetDbTagName(int nHandle, SymLinkApiString& tagName) = 0;
637     virtual int  GetDbTagHandle(const char *lpName, int& tagHandle) = 0;
638     //获取数据库点数据
639     virtual int  GetDbTagDataByHandle(int nHandle, SymLinkApiData& tagData) = 0;
640     virtual int  GetDbTagDataByName(const char *lpName, SymLinkApiData& tagData) = 0;
641     //获取变化缓存个数
642     virtual int  GetDbTagChangeCount(int &nCount) = 0;
643     //获取变化缓存(可以按照Handle来过滤)
644     virtual int  GetDbTagChange(int *pHandleBuf, SymLinkApiData *pDataBuf, int& nBufSize, int nHandle = -1) = 0;
645     //清理变化缓存(不处理变化缓存数据时可以调用该函数直接清理缓存数据)
646     virtual void  ClearDbTagChange() = 0;
647     //设置数据库点数据
648     virtual int  SetDbTagDataByHandle(int nHandle, const SymLinkApiData& tagData, int* pResult = 0, SymLinkApiString *pErrStr = 0) = 0;
649     virtual int  SetDbTagDataByName(const char *lpName, const SymLinkApiData& tagData, int* pResult = 0, SymLinkApiString *pErrStr = 0) = 0;
650     //获取断线缓存个数
651     virtual int  GetDbTagTxSaveCount(int &nCount) = 0;
652     //获取断线缓存
653     virtual int  GetDbTagTxSave(int *pHandleBuf, SymLinkApiData *pDataBuf, int& nBufSize) = 0;
654     //清理断线缓存(不处理断线缓存数据时可以调用该函数直接清理缓存数据)
655     virtual void  ClearDbTagTxSave() = 0;
656 
657     //获取断线缓存
658     virtual int  GetDbTagHistory(int tagHandle,
659         time_t startTime,
660         time_t endTime,
661         SymLinkApiData *pDataBuf,
662         int& nBufSize) = 0;
663     virtual int  GetDbTagHistory(const char *lpTagName,
664         time_t startTime,
665         time_t endTime,
666         SymLinkApiData *pDataBuf,
667         int& nBufSize) = 0;
668 };
669 
670 //上述类对象各自创建与销毁函数
671 CSymLinkApi* CreateSymLinkApi(int nType);
672 void FreeSymLinkApi(CSymLinkApi* lpSymApi);
673 
674 #endif
675 
676 #endif

我在c#里面想调用这个头文件里面的ConnectServer方法,怎样编译这个头文件才能生成一个dll文件

bokeyuan_number_1的主页 bokeyuan_number_1 | 初学一级 | 园豆:83
提问于:2017-09-06 14:54
< >
分享
最佳答案
0

参考 http://blog.csdn.net/big_wang5/article/details/8216557

或者 http://blog.csdn.net/szv123_rier/article/details/9345485

收获园豆:100
ycyzharry | 高人七级 |园豆:25683 | 2017-09-07 10:09
其他回答(3)
0

http://www.cnblogs.com/RascallySnake/p/3182807.html

里面有详细介绍

高软玩家 | 园豆:217 (菜鸟二级) | 2017-09-06 15:11
0

首先确认该文件是否为C++的源码,然后使用C++的编译器将.h文件编译成dll
命令的方式参考如下问答
http://topic.csdn.net/t/20050122/00/3745119.html

 

还有这个:http://blog.csdn.net/big_wang5/article/details/8216557

金琥 | 园豆:2605 (老鸟四级) | 2017-09-07 10:45
0

http://www.cnblogs.com/RascallySnake/p/3182807.html仔细看看

姚刘乐 | 园豆:70 (初学一级) | 2017-09-08 16:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册