www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - compile bug

reply Dan Abretske <danthemanisdead gmail.com> writes:
So I have a somewhat odd windows bug. Not sure if learn is the right 
place to ask this but....

I have a pragma to link in ws2_32.lib in my code for windows builds
and I have code that makes use of htonl(). When I compile code that 
doesn't use htonl() but makes use of sockets the code compiles and runs 
fine.  When I use code that uses htonl() but no sockets the code 
compiles and runs fine.
But when I try to compile code using both sockets and htonl() I get the 
following error.

C:\dmd\lib\phobos.lib(winsock)  Offset 1D966H Record Type 00C3
  Error 1: Previous Definition Different : _htonl 4


I'm using the build tool(bud.exe) to do my compiling and linking for me 
and it's not let me down yet so I'm hoping it's not build but I'm really 
not sure what to do about this error.  I opened up phobos.lib with vim 
and looked around abit and the string _htonl 4 appears 3 seperate places 
in the lib file... then again reading lib files isn't all that 
informative due to the whole not human readable thing.

Cheers,

Dan
Dec 11 2006
next sibling parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Tue, 12 Dec 2006 01:33:51 -0500, Dan Abretske wrote:

 So I have a somewhat odd windows bug. Not sure if learn is the right 
 place to ask this but....
 
 I have a pragma to link in ws2_32.lib in my code for windows builds
 and I have code that makes use of htonl(). When I compile code that 
 doesn't use htonl() but makes use of sockets the code compiles and runs 
 fine.  When I use code that uses htonl() but no sockets the code 
 compiles and runs fine.
 But when I try to compile code using both sockets and htonl() I get the 
 following error.
 
 C:\dmd\lib\phobos.lib(winsock)  Offset 1D966H Record Type 00C3
   Error 1: Previous Definition Different : _htonl 4
 
 I'm using the build tool(bud.exe) to do my compiling and linking for me 
 and it's not let me down yet so I'm hoping it's not build but I'm really 
 not sure what to do about this error.  I opened up phobos.lib with vim 
 and looked around abit and the string _htonl 4 appears 3 seperate places 
 in the lib file... then again reading lib files isn't all that 
 informative due to the whole not human readable thing.
I've asked about this error message from time to time and still yet to receive an answer on it. However, sometimes it goes away if you use the -full switch on the Bud command line. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 12/12/2006 5:38:15 PM
Dec 11 2006
parent Dan Abretske <danthemanisdead gmail.com> writes:
Heh,

Glad to know I'm not alone in this :)  As for -full it looks like it's 
not gonna save the day this time :)

Thanks though :)

Dan

Derek Parnell wrote:
 On Tue, 12 Dec 2006 01:33:51 -0500, Dan Abretske wrote:
 
 So I have a somewhat odd windows bug. Not sure if learn is the right 
 place to ask this but....

 I have a pragma to link in ws2_32.lib in my code for windows builds
 and I have code that makes use of htonl(). When I compile code that 
 doesn't use htonl() but makes use of sockets the code compiles and runs 
 fine.  When I use code that uses htonl() but no sockets the code 
 compiles and runs fine.
 But when I try to compile code using both sockets and htonl() I get the 
 following error.

 C:\dmd\lib\phobos.lib(winsock)  Offset 1D966H Record Type 00C3
   Error 1: Previous Definition Different : _htonl 4

 I'm using the build tool(bud.exe) to do my compiling and linking for me 
 and it's not let me down yet so I'm hoping it's not build but I'm really 
 not sure what to do about this error.  I opened up phobos.lib with vim 
 and looked around abit and the string _htonl 4 appears 3 seperate places 
 in the lib file... then again reading lib files isn't all that 
 informative due to the whole not human readable thing.
I've asked about this error message from time to time and still yet to receive an answer on it. However, sometimes it goes away if you use the -full switch on the Bud command line.
Dec 11 2006
prev sibling parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Abretske schrieb am 2006-12-12:
 So I have a somewhat odd windows bug. Not sure if learn is the right 
 place to ask this but....

 I have a pragma to link in ws2_32.lib in my code for windows builds
 and I have code that makes use of htonl(). When I compile code that 
 doesn't use htonl() but makes use of sockets the code compiles and runs 
 fine.  When I use code that uses htonl() but no sockets the code 
 compiles and runs fine.
 But when I try to compile code using both sockets and htonl() I get the 
 following error.

 C:\dmd\lib\phobos.lib(winsock)  Offset 1D966H Record Type 00C3
   Error 1: Previous Definition Different : _htonl 4
(I don't have a Window box at hand) Does ws2_32.lib define a _htonl 4 symbol? If it does it clashs with std.c.windows.winsock.htonl and you should file a Phobos bug. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFfyL9LK5blCcjpWoRAjLcAJ9wISBfmEi21vNcOoODzWq7EERnwwCfaY/V 9kaVAEFIEPV1nfa7bLA5UHU= =62XU -----END PGP SIGNATURE-----
Dec 12 2006
parent Dan Abretske <danthemanisdead gmail.com> writes:
Alright I'll check that.

The odd resolution to my problem was to move my main functions to 
separate files and then run build on those files but import the original 
file. I'm still not sure what's wrong but at least I got it working :)

Dan

Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Dan Abretske schrieb am 2006-12-12:
 So I have a somewhat odd windows bug. Not sure if learn is the right 
 place to ask this but....

 I have a pragma to link in ws2_32.lib in my code for windows builds
 and I have code that makes use of htonl(). When I compile code that 
 doesn't use htonl() but makes use of sockets the code compiles and runs 
 fine.  When I use code that uses htonl() but no sockets the code 
 compiles and runs fine.
 But when I try to compile code using both sockets and htonl() I get the 
 following error.

 C:\dmd\lib\phobos.lib(winsock)  Offset 1D966H Record Type 00C3
   Error 1: Previous Definition Different : _htonl 4
(I don't have a Window box at hand) Does ws2_32.lib define a _htonl 4 symbol? If it does it clashs with std.c.windows.winsock.htonl and you should file a Phobos bug. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFfyL9LK5blCcjpWoRAjLcAJ9wISBfmEi21vNcOoODzWq7EERnwwCfaY/V 9kaVAEFIEPV1nfa7bLA5UHU= =62XU -----END PGP SIGNATURE-----
Dec 12 2006