From: Roger Pack Date: 2009-01-18T02:08:02+09:00 Subject: [ruby-core:21393] Re: ruby macro bind conflicts tr1 on msvc9.0 ------=_Part_1952_139059.1232212156102 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I ran into a similar problem once [though it was with mingw and trying to use libev headers]. win32.h was overwriting a single named macro (OpenFile I believe) from deep within windows land :) My fix eventually was to separate the two files so that they were in different .o files, then the macro redefs didn't cause conflict. Good luck! -=r On Sat, Jan 17, 2009 at 8:45 AM, Christoph Heindl < christoph.heindl@gmail.com> wrote: > Hi, > It seems that the macro bind as defined in trunk/include/ruby/win32.h > conflicts with added tr1 support to msvc9.0 (which is essentially > SP1). The conflict arises when is > included along with visual studio standard tr1 include . > > > defines: > #ifdef bind > #undef bind > #endif > #define bind(s, a, l) rb_w32_bind(s, a, l) > > has template methods such as > > template class _Fty > _C_CLASS_ARG0> > _Bind<_Ret, > _BINDN<_Callable_obj<_Fty> _C_ARG0_ARG1> > > bind(_Fty _Val _C_ARG0_A0) // <--- here! > { // bind to UDT and user-specified return type > typedef _BINDN<_Callable_obj<_Fty> _C_ARG0_ARG1> _MyBind; > return (_Bind<_Ret, _MyBind>(_MyBind(_Val _C_A0_A1))); > } > Renaming the macro fixed the problem for compiling the ruby wrappers > I'm working on. Any solutions other than renaming are appreciated. > > Best regards, > Christoph > > > ------=_Part_1952_139059.1232212156102 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
I ran into a similar problem once [though it was with mingw and trying to use libev headers].
win32.h was overwriting a single named macro (OpenFile I believe) from deep within windows land :)
 
My fix eventually was to separate the two files so that they were in different .o files, then the macro redefs didn't cause conflict.
 
 
Good luck!
-=r
On Sat, Jan 17, 2009 at 8:45 AM, Christoph Heindl <christoph.heindl@gmail.com> wrote:
Hi,
It seems that the macro bind as defined in trunk/include/ruby/win32.h
conflicts with added tr1 support to msvc9.0 (which is essentially
SP1). The conflict arises when <trunk/include/ruby/win32.h> is
included along with visual studio standard tr1 include <xxbind>.


<trunk/include/ruby/win32.h> defines:
#ifdef bind
#undef bind
#endif
#define bind(s, a, l)           rb_w32_bind(s, a, l)

<xxbind> has template methods such as

template<class _Ret,
       class _Fty
       _C_CLASS_ARG0>
       _Bind<_Ret,
               _BINDN<_Callable_obj<_Fty> _C_ARG0_ARG1> >
                       bind(_Fty _Val _C_ARG0_A0)    // <--- here!
       {       // bind to UDT and user-specified return type
       typedef _BINDN<_Callable_obj<_Fty> _C_ARG0_ARG1> _MyBind;
       return (_Bind<_Ret, _MyBind>(_MyBind(_Val _C_A0_A1)));
       }
Renaming the macro fixed the problem for compiling the ruby wrappers
I'm working on. Any solutions other than renaming are appreciated.

Best regards,
Christoph



------=_Part_1952_139059.1232212156102--