[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby.h defining macros

John Ky

2/12/2009 12:11:00 AM

[Note: parts of this message were removed to make it a legal post.]

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

2 Answers

Bertram Scharpf

2/12/2009 4:54:00 AM

0

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


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...

Nobuyoshi Nakada

2/12/2009 5:14:00 AM

0

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.

--
Nobu Nakada