I am trying to migrate some code from 32-bit Windows (XP and Server 2003) to 64-bit Windows 7, and I am having a weird problem with gethostbyname.
I'm doing something like this:
struct hostent *hp;
hp = gethostbyname( host );
After the call to gethostbyname, the pointer hp->h_addr_list is invalid. It has all the right numbers, but it looks like a 32-bit pointer got stuffed into the wrong space somehow.
For example, what I get is
hp->h_addr_list = 0x0064bdd800000000
If I manually swap the first and last half so that hp->h_addr_list = 0x000000000064bdd8 then the pointer is valid and points to the correct data.
Sometimes I get baadf00d instead of zeros too (i.e. hp->h_addr_list = 0x0064bdd8baadf00d),
As far as I can tell everything is linked to the correct 64-bit version of the winsock libraries, so I'm not sure what could cause this kind of problem.