Duly noted. 

Is there a wiki which outlines practices/standards in case we run across
anything else?

Cheers,
Tim

On Thu, 2010-02-11 at 10:02 -0500, Andrew Stitcher wrote:
> On Wed, 2010-02-10 at 13:49 -0600, Timothy St. Clair wrote:
> > Ken - 
> > 
> > Attached is a patch I used to fix a qmfengine build issue I was having
> > on windows.  Probably want to validate it.
> > 
> > patch -p2 -i <patchfile>
> 
> Two points:
> 
> 1. [procedural] This patch needs to be attached to an upstream qpid 
> Jira for it to be considered by all the relevant qpid devs.
> 
> 2. Please don't do it this way. We have absolutely avoided using #ifdef
> when not essential. And I think you'll find that they are very rarely
> essential. The way we do this in the qpid C++ code is to have entirely
> separate Unix and Win32 implementations in different files and only link
> one of the files for a given platform.
> 
> Whatever you think of this strategy, and it has some downsides, that is
> the way we do it.
> 
> Offending part of the patch below.
> 
> [Sent to qpid dev list, to make this last point there]
> 
> Andrew
> 
> 
> --- a/qpid-cpp-mrg-0.7.904602/cpp/src/qmf/engine/ResilientConnection.cpp
> +++ b/qpid-cpp-mrg-0.7.904602/cpp/src/qmf/engine/ResilientConnection.cpp
> @@ -39,8 +39,15 @@
>  #include <set>
>  #include <boost/intrusive_ptr.hpp>
>  #include <boost/noncopyable.hpp>
> -#include <unistd.h>
>  #include <fcntl.h>
> +#ifndef WIN32
> +       #include <unistd.h>
> +#else 
> +       #include <io.h>
> +       #include <winsock2.h>
> +       #define write _write
> +#endif
> +
>  
>  using namespace std;
>  using namespace qmf::engine;
> @@ -333,8 +340,13 @@ void ResilientConnectionImpl::setNotifyFd(int fd)
>  {
>      notifyFd = fd;
>      if (notifyFd > 0) {
> +#ifndef WIN32
>          int original = fcntl(notifyFd, F_GETFL);
>          fcntl(notifyFd, F_SETFL, O_NONBLOCK | original);
> +#else
> +               u_long iMode=1;
> +               ioctlsocket(notifyFd, FIONBIO, &iMode);
> +#endif
>      }
>  }
>  
> 
> 


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to