Reputation: 167
I have following macro with me. I am getting error while using this macro. If you observe it has no end bracket for schema::schema()
. This is my macro header file.
#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(){
Upvotes: 0
Views: 307
Reputation: 258618
You can use it like so:
LoadSchemaDico(name)
//constructor code
}
Which will expand to:
class ExportedByVX0TOOLS name
{
public:
name();
};
extern "C" ExportedByVX0TOOLS int fctCreatename();
int fctCreatename()
{
int ret=1 ;
return ret;
}
name::name()
{
//constructor code
}
Upvotes: 1