[英]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.