Forum: Ruby ruby.h defining macros

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af8de1217dfad889f8849fd0223d83c8?d=identicon&s=25 John Ky (Guest)
on 2009-02-12 01:16
(Received via mailing list)
Hi Ruby Talk,

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
C06869c119472a139eb163b72040b0db?d=identicon&s=25 Bertram Scharpf (Guest)
on 2009-02-12 05:57
(Received via mailing list)
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
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2009-02-12 06:15
(Received via mailing list)
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.
This topic is locked and can not be replied to.