[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: Macros in win32.h
From:       james () jamesjrg ! com
Date:       2005-06-25 12:18:48
Message-ID: 20050625071845.a5rzks28m5cg8gw8 () 67 ! 15 ! 111 ! 134
[Download RAW message or body]

Quoting Austin Ziegler <halostatue@gmail.com>:

> On 6/25/05, james@jamesjrg.com <james@jamesjrg.com> wrote:
>> Quoting Austin Ziegler <halostatue@gmail.com> :
>> > On 6/25/05, james@jamesjrg.com <james@jamesjrg.com> wrote:
>>>> win32.h defines a load of macros. This means any C or C++
>>>> program which embeds ruby cannot have variables, functions or
>>>> member functions with the same name as these macros. So you
>>>> cannot have functions or variables with such common names as
>>>> "accept", "bind", "connect", "send", "shutdown" etc. Is it not
>>>> possible to implement the Windows version of the Ruby header
>>>> files without macros?
>>> These names would need to exist in the global namespace in any
>>> case (at least accept(), bind(), connect(), and send()) because
>>> they're used for network communications.
>> But MyClass::connect does not conflict with ::connect
>
> I'll grant that, but note that Ruby is a C application and as such,
> there's only the one global namespace (effectively), and ::connect
> is an invalid syntactic in C. I'm not saying the problem couldn't be
> fixed, but suggesting why it might be a lower priority. For C
> programs, these macros aren't problematic (sorry, but they aren't --
> they're reality). For C++ programs, they probably are, but you might
> be better suited to using Ruby as a DLL. I don't know, honestly,
> what would be involved in doing that, but that would probably be a
> better way to handle this.

Maybe I misunderstand, but surely even if you use it as a dll you still 
need to
include the header files? Anyway, my solution was just to delete the macros in
my copy of the file.

> And, to be honest, there are bigger problems with the Windows
> version of Ruby than these names; the fact that there's no support
> for Unicode filesystem operations in Ruby is a far bigger problem to
> me than embedding issues.

OK, fair enough,

James


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic