digitalmars.D - Bug? Error in phobos?
- Regan Heath (25/25) Sep 20 2007 import std.socket;
- Regan Heath (5/35) Sep 21 2007 No-one?? This bug is particularly annoying because it prevents me from
- BCS (4/14) Sep 21 2007 I don't known why your getting it, but you must have more than one ntohl...
- Regan Heath (15/31) Sep 21 2007 No such luck :(
- BCS (2/28) Sep 21 2007 long shoot: grab a fresh dmd.zip, replace ws2_32.lib. It might be bad.
- Regan Heath (4/33) Sep 21 2007 I get the impression Tom tried it and it gives the same error for him.
- dickl (8/29) Sep 25 2007 Looks like a phobos problem.
- TomD (5/42) Sep 21 2007 It works when you drop the new TcpSocket(). Go figure. It gives me no cl...
- Regan Heath (4/45) Sep 21 2007 I reckon "new TcpSocket" causes the linker to link something it
- Carlos Santander (4/29) Sep 21 2007 Can you check if std.socket already has pragma(lib) ?
- Jarrett Billingsley (4/5) Sep 21 2007 Even if it does I don't think pragma(lib)s work if you only import the f...
- Regan Heath (4/39) Sep 22 2007 Ok... It does not.
import std.socket; import std.c.windows.winsock; pragma(lib, "wsock32.lib"); class IndexPacketReader { //static void foo() //works void foo() { ntohl(1); //fails } } void main() { new TcpSocket(); //ntohl(1); //works } E:\D\src\tmp>dmd bug003.d E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means? Regan
Sep 20 2007
Regan Heath wrote:import std.socket; import std.c.windows.winsock; pragma(lib, "wsock32.lib"); class IndexPacketReader { //static void foo() //works void foo() { ntohl(1); //fails } } void main() { new TcpSocket(); //ntohl(1); //works } E:\D\src\tmp>dmd bug003.d E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that. Regan
Sep 21 2007
Reply to Regan,I don't known why your getting it, but you must have more than one ntohl defined. The linker is finding this so I expect that one is in a lib. Try dropping the pragma (lib) and explictly linking c:\dmd\lib\WS2_32.LIB directly.Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that.Regan
Sep 21 2007
BCS wrote:Reply to Regan,That's what I thought might be happening.I don't known why your getting it, but you must have more than one ntohl defined. The linker is finding this so I expect that one is in a lib.Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that.Try dropping the pragma (lib) and explictly linking c:\dmd\lib\WS2_32.LIB directly.No such luck :( E:\D\src\tmp>dmd bug003 e:\d\dmd\lib\ws2_32.lib E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,e:\d\dmd\lib\ws2_32.lib+user32+kerne l32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 I tried wsock32.lib, ws2_32.lib at prompt, as pragmas, nothing seems to want to link. Regan
Sep 21 2007
Regan Heath wrote:BCS wrote:long shoot: grab a fresh dmd.zip, replace ws2_32.lib. It might be bad.Reply to Regan,That's what I thought might be happening.I don't known why your getting it, but you must have more than one ntohl defined. The linker is finding this so I expect that one is in a lib.Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that.Try dropping the pragma (lib) and explictly linking c:\dmd\lib\WS2_32.LIB directly.No such luck :(
Sep 21 2007
BCS wrote:Regan Heath wrote:I get the impression Tom tried it and it gives the same error for him. I'll grab a fresh dmd and give it a go but I wont hold my breath. ReganBCS wrote:long shoot: grab a fresh dmd.zip, replace ws2_32.lib. It might be bad.Reply to Regan,That's what I thought might be happening.I don't known why your getting it, but you must have more than one ntohl defined. The linker is finding this so I expect that one is in a lib.Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that.Try dropping the pragma (lib) and explictly linking c:\dmd\lib\WS2_32.LIB directly.No such luck :(
Sep 21 2007
Looks like a phobos problem. ntohl can be found in both phobos.lib and wsock32.lib. If you don't link with wsock32.lib, the error relating to ntohl goes away (and creates other problems). std.c.windows.socket has its own version of ntohl. It should either be a unique name or refer to wsock32.lib. Dick BCS wrote:Reply to Regan,I don't known why your getting it, but you must have more than one ntohl defined. The linker is finding this so I expect that one is in a lib. Try dropping the pragma (lib) and explictly linking c:\dmd\lib\WS2_32.LIB directly.Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that.Regan
Sep 25 2007
Regan Heath Wrote:Regan Heath wrote:It works when you drop the new TcpSocket(). Go figure. It gives me no clue what may be the reason. Ciao TomDimport std.socket; import std.c.windows.winsock; pragma(lib, "wsock32.lib"); class IndexPacketReader { //static void foo() //works void foo() { ntohl(1); //fails } } void main() { new TcpSocket(); //ntohl(1); //works } E:\D\src\tmp>dmd bug003.d E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that. Regan
Sep 21 2007
TomD wrote:Regan Heath Wrote:I reckon "new TcpSocket" causes the linker to link something it otherwise wouldn't. That's the extent of my knowledge however :( ReganRegan Heath wrote:It works when you drop the new TcpSocket(). Go figure. It gives me no clue what may be the reason.import std.socket; import std.c.windows.winsock; pragma(lib, "wsock32.lib"); class IndexPacketReader { //static void foo() //works void foo() { ntohl(1); //fails } } void main() { new TcpSocket(); //ntohl(1); //works } E:\D\src\tmp>dmd bug003.d E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means?No-one?? This bug is particularly annoying because it prevents me from calling ntohl, ntohs etc from within a class method. In the end I just wrote my own ntohl functin and called that. Regan
Sep 21 2007
Regan Heath escribió:import std.socket; import std.c.windows.winsock; pragma(lib, "wsock32.lib"); class IndexPacketReader { //static void foo() //works void foo() { ntohl(1); //fails } } void main() { new TcpSocket(); //ntohl(1); //works } E:\D\src\tmp>dmd bug003.d E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 Error 1: Previous Definition Different : _ntohl 4 --- errorlevel 1 Anyone know what this means? ReganCan you check if std.socket already has pragma(lib) ? -- Carlos Santander Bernal
Sep 21 2007
"Carlos Santander" <csantander619 gmail.com> wrote in message news:fd18ni$1ucu$1 digitalmars.com...Can you check if std.socket already has pragma(lib) ?Even if it does I don't think pragma(lib)s work if you only import the file. I think it has to be compiled.
Sep 21 2007
Carlos Santander wrote:Regan Heath escribió: > import std.socket; > import std.c.windows.winsock; > > pragma(lib, "wsock32.lib"); > > class IndexPacketReader > { > //static void foo() //works > void foo() > { > ntohl(1); //fails > } > } > > void main() > { > new TcpSocket(); > //ntohl(1); //works > } > > E:\D\src\tmp>dmd bug003.d > E:\D\dmd\bin\..\..\dm\bin\link.exe bug003,,,user32+kernel32/noi; > OPTLINK (R) for Win32 Release 7.50B1 > Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved > > E:\D\dmd\bin\..\lib\phobos.lib(winsock) Offset 276FEH Record Type 00C3 > Error 1: Previous Definition Different : _ntohl 4 > --- errorlevel 1 > > Anyone know what this means? > > Regan Can you check if std.socket already has pragma(lib) ?Ok... It does not. In fact "pragma" is not used in phobos at all. Regan
Sep 22 2007