ruby.h defining macros

Discussion in 'Ruby' started by John Ky, Feb 12, 2009.

  1. John Ky

    John Ky Guest

    [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
    John Ky, Feb 12, 2009
    #1
    1. Advertising

  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


    --
    Bertram Scharpf
    Stuttgart, Deutschland/Germany
    http://www.bertram-scharpf.de
    Bertram Scharpf, Feb 12, 2009
    #2
    1. Advertising

  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.

    --
    Nobu Nakada
    Nobuyoshi Nakada, Feb 12, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    80
    Views:
    2,348
    Stephen J. Bevan
    Nov 7, 2003
  2. Replies:
    1
    Views:
    425
    Marco Antoniotti
    Oct 7, 2003
  3. Replies:
    5
    Views:
    483
  4. Michael T. Babcock

    Re: Explanation of macros; Haskell macros

    Michael T. Babcock, Nov 3, 2003, in forum: Python
    Replies:
    0
    Views:
    505
    Michael T. Babcock
    Nov 3, 2003
  5. Andrew Arro

    macros-loop? calling macros X times?

    Andrew Arro, Jul 23, 2004, in forum: C Programming
    Replies:
    2
    Views:
    476
    S.Tobias
    Jul 24, 2004
Loading...

Share This Page