Ticket #5 (assigned defect)

Opened 9 years ago

Last modified 8 years ago

getAddrInfo and addrFamily not in scope on Windows GHC 6.8

Reported by: igloo Owned by: bos
Priority: major Milestone:
Component: network Version:
Keywords: Cc:


Originally reported here: http://hackage.haskell.org/trac/ghc/ticket/2726

import Network.Socket

... getAddrInfo

... addrFamily


gives me not in scope on Windows. The same code works on Unix.

Looking at the code, these are only available if IPV6_SOCKET_SUPPORT is defined. I don't know more than that off the top of my head.

Change History

Changed 8 years ago by bos

  • owner set to bos
  • status changed from new to assigned

This is really ugly to deal with. I've got tentative code that should (but doesn't) detect getaddrinfo on Windows properly. Easy, right?

The base problem is that a working version of the function wasn't introduced until Windows XP, but there's a cheeeezy hack for some earlier releases that tries to find a half-working version in wship6.dll via a runtime probe.

Gruesome details near the end of this page: http://msdn.microsoft.com/en-us/library/ms738520(VS.85).aspx

Gruesome details, part deux, in this thread: http://readlist.com/lists/lists.sourceforge.net/mingw-users/0/1544.html

Because autoconf goes out of its way to find a nice clean definition of a function, it's not even straightforward to write a correct autoconf macro to find getaddrinfo correctly on Windows. I'm trying to set the WINVER macro to 0x0501 (aka WindowsXP), but autoconf is undoing my work by deliberately doing a #undef getaddrinfo. It's all rather confusing.

Changed 8 years ago by anonymous

I've pushed some changes to the darcs repo that sort of fix this, but the code will only work on XP and Vista.

I'll write a version of getaddrinfo that should work on Windows 2000 with the IPv6 technology preview (it'll look in ws2_32.dll then wship6.dll at runtime, instead of link time), but it'll be maybe a week before I get that done.

Changed 8 years ago by tibbe

  • milestone set to
Note: See TracTickets for help on using tickets.