# Ruby.h defining macros

**URL:** <https://www.ruby-forum.com/t/ruby-h-defining-macros/160132>\
**Category:** Ruby\
**Created:** [February 12, 2009, 1:16am UTC](https://www.ruby-forum.com/t/ruby-h-defining-macros/160132 "2009-02-12T01:16:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Ky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c4cdca/32.png) [@John\_Ky](https://www.ruby-forum.com/u/John_Ky)\
**Post date:** [February 12, 2009, 1:16am UTC](https://www.ruby-forum.com/t/ruby-h-defining-macros/160132/1 "2009-02-12T01:16:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Ky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c4cdca/32.png) [@John\_Ky](https://www.ruby-forum.com/u/John_Ky)\
**Post date:** [February 12, 2009, 5:57am UTC](https://www.ruby-forum.com/t/ruby-h-defining-macros/160132/2 "2009-02-12T05:57:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Ky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c4cdca/32.png) [@John\_Ky](https://www.ruby-forum.com/u/John_Ky)\
**Post date:** [February 12, 2009, 6:15am UTC](https://www.ruby-forum.com/t/ruby-h-defining-macros/160132/3 "2009-02-12T06:15:53Z")

</div>

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.
