[m-rev.] [PATCH 2/2] [net] Make the C code compatible with Windows

Julien Fischer jfischer at opturion.com
Tue Jan 13 12:37:48 AEDT 2015


On Tue, Jan 13, 2015 at 12:34 PM, Paul Bone <paul at bone.id.au> wrote:

> On Mon, Jan 12, 2015 at 05:02:10PM +1100, Julien Fischer wrote:
> >
> > Hi Paul,
> >
> > On Sat, 10 Jan 2015, Paul Bone wrote:
> >
> >> extras/net/netdb.m:
> >> extras/net/sockets.m:
> >> extras/net/tcp.m:
> >> extras/net/types.m:
> >>    Include the correct header files.
> >>
> >>    Fix the order of statements in a code block.
> >>
> >>    Workarround the missing SHUT_RDWR macro on windows.
> >>
> >>    Avoid use of socklen_t.
> >> ---
> >> extras/net/netdb.m   | 10 ++++++++--
> >> extras/net/sockets.m |  7 ++++---
> >> extras/net/tcp.m     |  4 ++--
> >> extras/net/types.m   | 13 +++++++++----
> >> 4 files changed, 23 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/extras/net/netdb.m b/extras/net/netdb.m
> >> index 8021d7e..fe5ab15 100644
> >> --- a/extras/net/netdb.m
> >> +++ b/extras/net/netdb.m
> >> @@ -82,7 +82,12 @@
> >>
> >> :- pragma foreign_decl("C",
> >> "
> >> -#include <netdb.h>
> >> +#ifdef MR_WIN32
> >> +    #include <winsock2.h>
> >> +    #include <ws2tcpip.h>
> >
> > You need to do:
> >
> >    #include ""mercury_windows.h""
> >
> > *before* you include winsock2.h etc there.  Doing so ensures that the
> > macros that prevent the automatic inclusion of winsock.h (which will
> > conflict with winsock2.h) are defined.  (See comments in
> > runtime/mercury_windows.h.)
> >
> > And indeed everywhere else stuff from the Windows API is #included.
> >
>
> Thanks Julien.
>
> I just started getting errors because of this when compiling an application
> against this library (but not the library itself).  I've fixed it in my
> workspace but I'm still getting the errors.


I suspect the errors you are getting are what mercury_windows.h was
intended to
avoid -- we had similar issues with the networking code in G12, which was
why
I added that header in the first place.

Cheers,
Julien.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20150113/524204cd/attachment.html>


More information about the reviews mailing list