Reentrant API/IDL_KW_OFFSETOF() issue [message #38538] |
Tue, 16 March 2004 15:47 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
I have run into a problem with the IDL_KW_OFFSETOF() macro and the new
keyword processing API. Starting with a functioning .cpp dlm, I set about
to add a few keywords. Along the way I decided to switch the keyword
processing to use the new API. A fine way to spend an afternoon...
The problem is that the compiler chokes on the return value from
IDL_KW_OFFSETOF() macro. It expects "char *" and gets "void *". I can
recast everything but the EDG (and Ronn's book) make no mention of this and
my C/C++ skills are such that I don't really trust myself and assume that I
am in the wrong.
I see IDL_KW_V_OFFSETOF() returns "char *" but again, no mention in the EDG
or Ronn's book.
The relevant code:
typedef struct {
IDL_KW_RESULT_FIRST_FIELD;
IDL_VPTR oAngle;
IDL_VPTR oInIDX;
IDL_VPTR oLocation;
IDL_VPTR oOutIDX;
} KW_RESULT;
static IDL_KW_PAR keywords[]={
IDL_KW_FAST_SCAN,
{"ANGLE" ,IDL_TYP_UNDEF,1,IDL_KW_OUT|IDL_KW_ZERO,0,IDL_KW_OFFSETOF(oA ngle)},
{"INIDX" ,IDL_TYP_UNDEF,1,IDL_KW_OUT|IDL_KW_ZERO,0,IDL_KW_OFFSETOF(oI nIDX)},
{"LOCATION" ,IDL_TYP_UNDEF,1,IDL_KW_OUT|IDL_KW_ZERO,0,IDL_KW_OFFSETOF(oL ocati
on)},
{"OUTIDX" ,IDL_TYP_UNDEF,1,IDL_KW_OUT|IDL_KW_ZERO,0,IDL_KW_OFFSETOF(oO utIDX)}
,
{NULL}
};
The error:
FAR_Echosounder.cpp(286) : error C2440: 'initializing' : cannot convert from
'void *' to 'char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Of course, this error is generated for every call to IDL_KW_OFFSETOF().
What am I missing?
-Rick
|
|
|