Well, the version I'm using right now, that sorta works, is:
#define OCALL( obj,func,... ) obj->func ( obj, ## __VA_ARGS__ )
(new names to make it more readable)
The problem is that it won't work with methods which don't have any arguments. (which is what the ## is supposed to be for). for example, I have an object CFile which has a method called Destroy (which preforms deallocating of heap variables). The only argument required of this method is that of the object itself (ie __VA_ARGS__ is empty). Using the above code, here is what I'm getting for the Destroy method (as well as the Write method just to show it working in a different sence).
#define OCALL( obj,func,... ) obj->func ( obj, ## __VA_ARGS__ )
...
// part of the c_file (aka CFile) struct
typedef struct c_file {
void ( * Write ) ( struct c_file *, char * );
void ( * Destroy ) ( struct c_file * );
...
void CFile_Write ( CFile *, char * );
void CFile_Destroy ( CFile * );
...
// inside CFile_Create routine for initialization
this->Write = CFile_Write;
this->Destroy = CFile_Destroy;
...
// this code works
OCALL ( fout,Write, buffer );
fout->Write ( fout, buffer );
fout->Destroy ( fout );
...
// this code won't work
OCALL ( fout,Destroy );
Now all the above code works with GCC just fine (with the exception that OCALL is defined with a named vararg like in my first post) This is why when you stated "You missed the ',' (comma) before the variable list designator (...). " I was a bit confused, because in GCC you can name them, I was specifying 'c' as my variable list. I now know that PellesC doesn't use this convention. But the problem now is mearly that (from what I can tell) it always wants to add the comma even when the __VA_ARGS__ list is empty. I'm afraid I'm not making myself clear, and it's totally my fault, I'm horrible at explaining myself (I've been told this many times) I guess I'll just use OCALL() for use with methods which contain arguments, and I'll use the long way for methods which don't contain any.
PS: btw the code you used below doesn't seem to work at all for me. I tried this:
#define OCALL( obj,func,arg,... ) obj->func ( obj, ##arg, __VA_ARGS__ )
And I get the following error on every line which contains a call to OCALL:
error #1053: Disagreement in number of macro arguments.