Thread overview
WinSock and dmc
Feb 23, 2005
Mike Benfield
Feb 23, 2005
Scott Michel
Feb 23, 2005
Mike Benfield
Feb 24, 2005
Scott Michel
February 23, 2005
Hi,
I'm trying to compile my socket-using library with Digital Mars.
The problem I ran into was that the winsock2.h and ws2_32.lib
included with Digital Mars don't have a few things that are in
Microsoft's WinSock (and in POSIX sockets) like getaddrinfo,
sockaddr_storage, etc.

I decided to try to use Microsoft's implementation with DM. I put the stuff from its headers I needed into the DM headers, and then I ran coff2omf on its socket library. Everything compiles, but when I try to link, it can't find definitions for getaddrinfo and freeaddrinfo. Here's what's weird... Those definitions are present in ws2_32.lib before I run coff2omf on it, and they're gone after. Check it out:

$ grep freeaddrinfo ws2_32.lib
Binary file ws2_32.lib matches

$ /cygdrive/c/dm/bin/coff2omf.exe ws2_32.lib
COFF2OMF: Converting '\\192.168.1.100\mike\wd\ws2_32.lib'

$ grep freeaddrinfo ws2_32.lib

And then no match. (Other symbols that were in there before are still there.) I don't know anything about these COFF and OMF formats so I don't know if this is surprising behavior to others or not.

In any case, help on any level would be appreciated, whether it be explaining the behavior here or just telling me on a practical level how to get an up to date WinSock I can use with DM.

Thanks,
Mike


February 23, 2005
Mike Benfield wrote:
> Hi,
> I'm trying to compile my socket-using library with Digital Mars.
> The problem I ran into was that the winsock2.h and ws2_32.lib
> included with Digital Mars don't have a few things that are in
> Microsoft's WinSock (and in POSIX sockets) like getaddrinfo,
> sockaddr_storage, etc.
> 
> I decided to try to use Microsoft's implementation with DM. I put the
> stuff from its headers I needed into the DM headers, and then I ran
> coff2omf on its socket library. Everything compiles, but when I try to
> link, it can't find definitions for getaddrinfo and freeaddrinfo. Here's
> what's weird... Those definitions are present in ws2_32.lib before I run
> coff2omf on it, and they're gone after. Check it out:
> 
> $ grep freeaddrinfo ws2_32.lib
> Binary file ws2_32.lib matches
> 
> $ /cygdrive/c/dm/bin/coff2omf.exe ws2_32.lib
> COFF2OMF: Converting '\\192.168.1.100\mike\wd\ws2_32.lib'

You're missing a step here: Get a hold of an older version of MS LINK. If you look for MASM32 on the web, there's a reasonable copy in their distribution. The magic incantation is:

link /lib /convert ws2_32.lib
comm2omf ws2_32.lib


-scooter
February 23, 2005
> link /lib /convert ws2_32.lib
> comm2omf ws2_32.lib

Thanks, that did it!

Mike


February 24, 2005
Mike Benfield wrote:
>>link /lib /convert ws2_32.lib
>>comm2omf ws2_32.lib
> 
> 
> Thanks, that did it!
> 
> Mike 

Did you remember to sacrifice the goat, light the red candles and chant from the old leather book too? The moon in currently in the third greater Epicentralian cycle, so you should have close to unlimited success on days ending in "y"!

Glad it worked out for you!


-scooter