Forum: Ruby-core [Bug #1705] Ruby macros on windows

Posted by Vit Ondruch (Guest)
on 2009-06-30 10:45
(Received via mailing list)
Bug #1705: Ruby macros on windows
http://redmine.ruby-lang.org/issues/show/1705

Author: Vit Ondruch
Status: Open, Priority: Normal
ruby -v: 1.8.5 - 1.9.1

Hello,

win32.h header of Ruby 1.8.5 - 1.9.1 contains a lot of macros such as:

#ifdef bind
#undef bind
#endif
#define bind(s, a, l)    rb_w32_bind(s, a, l)

#ifdef connect
#undef connect
#endif
#define connect(s, a, l)  rb_w32_connect(s, a, l)

#define close(h)    rb_w32_close(h)

I believe that this is dangerous practice. Such names are quite common 
method or variable names and once you include Ruby.h in your project, it 
can result in unpredictable results. There was already one thread opened 
about this issue: http://www.ruby-forum.com/topic/176026#new 
unfortunately it did not bring any attention.

Could you please suggest any workaround or better consider another way 
of define these macros or the best use some prefix, since it seems that 
the methods are ruby specific anyway.

Thank you

Vit
Posted by Nobuyoshi Nakada (Guest)
on 2009-06-30 11:34
(Received via mailing list)
Issue #1705 has been updated by Nobuyoshi Nakada.

Status changed from Open to Rejected

It has been solved in 1.9 already.
You miss #ifndef RUBY_EXPORT contitionals.
In 1.8, it's rejected due to binary compatibilities.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1705
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.