AFIAK, this isn''t possible. There are two reasonable possibilies... Firstly, declare both the virtual and the exported functions with the same macro. Then you only pass the argument list once, thus there can be no mismatch problem.
If you can''t declare them at the same time... Can #define expansions contain other #define commands? If yes, I''d suggest, tentatively, something like:
#define DEF_CLASS(name) \#ifdef __CLASSNAME \#undef __CLASSNAME \#endif \#define __CLASSNAME name \ class name \#define DEF_VITRUAL(name, args) \#define __CLASSNAME_ ## name ## _ARGS args \void virtual name args#define DEF_EXPORT(name) \__declspec(dllexport) void V ## name __CLASSNAME_ ## name ## _ARGSDEF_CLASS(Obj){ DEF_VIRTUAL(Func, (int)); DEF_EXPORT(Func);}
I''d use the __CLASSNAME so we didn''t get Foo::wombat and Baz::wombat mixed up. However, I don''t know if the preprocessor works like this, and I don''t think it''s a good idea anyway: what about polymorphic functions? If the same function name is associated with several different actual functions, there''s no way to make it work without repeating the parameter list each time.
I''d opt for defining both methods with one macro.
Hail Eris! All fnord hail Discordia!