簡體   English   中英

如何在我的cpp程序中使用此宏?

[英]How to use this macro in my cpp program?

我有以下宏。 使用此宏時出現錯誤。 如果您觀察到它沒有schema::schema()結尾括號。 這是我的宏頭文件。

#ifdef _WINDOWS_SOURCE
#define ExportedByVX0TOOLS  __declspec(dllexport)  
#else
#define ExportedByVX0TOOLS
#endif

#include <stdio.h>
#include <string.h>
//
#if defined(_WINDOWS_SOURCE)
#include <errno.h>
#include <io.h>
#endif
#if defined(_IRIX_SOURCE) || defined(_SUNOS_SOURCE) || defined(_HPUX_SOURCE) || defined(_AIX)
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#endif

#define LoadSchemaDico(schema)\
        class ExportedByVX0TOOLS schema { public: schema();};\
        extern "C" ExportedByVX0TOOLS int fctCreate##schema();\
        int  fctCreate##schema(){ int ret=1 ; return ret; }\
        schema::schema(){ 

您可以這樣使用它:

LoadSchemaDico(name)
//constructor code
}

它將擴展為:

class ExportedByVX0TOOLS name
{ 
   public: 
       name();
};
extern "C" ExportedByVX0TOOLS int fctCreatename();
int  fctCreatename()
{ 
   int ret=1 ; 
   return ret; 
}
name::name()
{
//constructor code
} 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM