www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Linker - Conflict between phobos.lib and ws2_32.lib

V2.002 - here is the example - I can't quite get it down to 10 lines:

import std.c.windows.winsock;
import std.socket;
void main(char[][] args)
{
   Socket s = new TcpSocket();
   int n = 0;
   switch (n)
   {
      case 2:
      case 7:
      case 8:
      case 10:
         ushort u = htons(1);
   }
}

Gives:
d:\dmd\bin\..\..\dm\bin\link.exe container,,,ws2_32.lib+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

d:\dmd\bin\..\lib\phobos.lib(winsock)  Offset 27E1FH Record Type 00C3
 Error 1: Previous Definition Different : _htons 4

If you don't create the Socket, links cleanly. If you comment out any of the
case statements links cleanly.  If you explicitly link phobos first, links
cleanly.
Jul 09 2007