On 01/23/2012 04:06 AM, Kinkie wrote: > On Fri, Jan 20, 2012 at 11:52 PM, Alex Rousskov > <rouss...@measurement-factory.com> wrote: >> On 01/20/2012 07:11 AM, Kinkie wrote: >> >>> Oh, and I've hit a major snag with the windows port: TypedMsgHdr >>> inherits from msghdr, which is not available on MinGW. There are >>> several variants, but in order to try and understand what can be done >>> (and if I'm up to the task) I would need to understand what is the >>> purpose of this choice.. >> >> TypedMsgHdr is a raw UDS message wrapper that adds data types, socket >> descriptor passing, and other Squid-specific stuff to msghdr. >> >> Until we add a Windows-specific mechanism to pass socket descriptors on >> Windows, we should not enable SMP stuff on Windows. This means that >> either TypedMsgHdr should not be _compiled_ at all OR we should provide >> a dummy msghdr replacement on Windows and make sure TypedMsgHdr is not >> _used_ on Windows. > > The problem is at build time.. there is no msghdr on Windows. So > either I emulate it via a squid-specific struct (which is what I'm > attempting), or the data model needs changes so that it owns a msghdr > instead of inheriting from one, so that on Linux it can be a msghdr, > on windows it can be something else..
Whether you are using inheritance or not, we can hide platform-specific stuff behind TypedMsgHdr and lower APIs. The higher level decision is whether we need to compile TypedMsgHdr at all when SMP is disabled. My understanding is that you are saying that yes, we have to compile it, so I will assume that. Whether it is better to continue to use inheritance or switch to a data member depends on the msghdr/etc API for a given platform. For a dummy squid-specific struct representing msghdr to make TypedMsgHdr and friends compile on Windows, it would probably be easier to keep the inheritance model. We can always switch to a data member later, after evaluating the needs of non-dummy platform-specific APIs. Overall, the result will look like this: #if using windows struct msghdr { ... }; ... #endif class TypedMsgHdr: public msghdr { ... }; HTH, Alex.