www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - WinSock and dmc

↑ ↓ ← "Mike Benfield" <leftfist mac.com> writes:
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 
Feb 23 2005
↑ ↓ Scott Michel <scottm aero.org> writes:
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
Feb 23 2005
↑ ↓ "Mike Benfield" <leftfist mac.com> writes:
 link /lib /convert ws2_32.lib
 comm2omf ws2_32.lib

Thanks, that did it! Mike
Feb 23 2005
↑ ↓ → Scott Michel <scottm aero.org> writes:
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
Feb 23 2005