Ruby.h defining macros


#1

Hi Ruby T.,

When I include ruby.h, I’m getting new macros defined such as
strcmpcase,
and close on the Windows platform. This is conflicting with macros and
function names in my own project. Is there a way to disable these macro
definitions?

Thanks

-John


#2

Hi John,

Am Donnerstag, 12. Feb 2009, 09:11:18 +0900 schrieb John Ky:

When I include ruby.h, I’m getting new macros defined such as strcmpcase,
and close on the Windows platform. This is conflicting with macros and
function names in my own project. Is there a way to disable these macro
definitions?

In my humble opinion, it were a lucky decision to name it
“rb_strcmpcase” instead of “strcmpcase”. (Besides that,
“strcmpcase” is a bad example as it does’t occur.) Anyhow, you
should yourself name your functions like “jk_strcmpcase”.

This is a poor answer, I know. But C isn’t an object-oriented
language and there’s no namespace solution provided.

Bertram


#3

Hi,

At Thu, 12 Feb 2009 09:11:18 +0900,
John Ky wrote in [ruby-talk:327815]:

When I include ruby.h, I’m getting new macros defined such as strcmpcase,
and close on the Windows platform. This is conflicting with macros and
function names in my own project. Is there a way to disable these macro
definitions?

There is no strcmpcase, so I guess you meant strcasecmp in
win32.h, right?

#define strcasecmp stricmp
#define strncasecmp strnicmp

These definitions are specific for MSVCRT which doesn’t provide
these standard functions, and if you have same functions, you
can #undef them of course.