C Preprocessor question

I have a macro that looks like

#define DEF_OID_QUERY(oid, min_length) {oid, #oid, min_length,
XenNet_##oid, NULL}

So that DEF_OID_QUERY(OID_GEN_HARDWARE_STATUS, 42) expands to
{OID_GEN_HARDWARE_STATUS, “OID_GEN_HARDWARE_STATUS”, 42,
XenNet_OID_JAMES, NULL} which works fine. I then have another macro that
references that first macro:

#define DEF_OID_QUERY_ULONG(oid) DEF_OID_QUERY(oid, sizeof(ULONG)

But that expands out the oid too early such that
DEF_OID_QUERY_ULONG(OID_GEN_HARDWARE_STATUS) becomes {0x00010102,
“0x00010102”, 4, XenNet_0x00010102, NULL} which isn’t what I want. I
want the oid to remain symbolic. Is there a way to do that without
rewriting my DEF_OID_QUERY_ULONG macro to not call DEF_OID_QUERY?

It’s not a big deal as they are only little macro’s but it would be nice
if there was a way.

Thanks

James

>

I have a macro that looks like

#define DEF_OID_QUERY(oid, min_length) {oid, #oid, min_length,
XenNet_##oid, NULL}

So that DEF_OID_QUERY(OID_GEN_HARDWARE_STATUS, 42) expands to
{OID_GEN_HARDWARE_STATUS, “OID_GEN_HARDWARE_STATUS”, 42,
XenNet_OID_JAMES, NULL} which works fine. I then have another macro
that
references that first macro:

#define DEF_OID_QUERY_ULONG(oid) DEF_OID_QUERY(oid, sizeof(ULONG)

But that expands out the oid too early such that
DEF_OID_QUERY_ULONG(OID_GEN_HARDWARE_STATUS) becomes {0x00010102,
“0x00010102”, 4, XenNet_0x00010102, NULL} which isn’t what I want. I
want the oid to remain symbolic. Is there a way to do that without
rewriting my DEF_OID_QUERY_ULONG macro to not call DEF_OID_QUERY?

It’s not a big deal as they are only little macro’s but it would be
nice
if there was a way.

Nevermind. I figured it out…

#define DEF_OID_QUERY_ULONG(oid) DEF_OID_QUERY(##oid, sizeof(ULONG))

works just fine.

Thanks

James