ruby.h defining macros

J

John Ky

[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
 
B

Bertram Scharpf

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
 
N

Nobuyoshi Nakada

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

RUBY_VERSION_* macros in C? 2
Finding ruby.h 3
Defining class methods 11
problem with swig & ruby 3
Endianness macros 48
Defining your own typecaster 4
Hosting Ruby in C# 2
Linux headers 0

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top