Thread overview
DMD: LINK!!! Please link!
Sep 10, 2002
andy
Sep 10, 2002
Pavel Minayev
Sep 11, 2002
andy
Sep 11, 2002
andy
Sep 11, 2002
Pavel Minayev
Sep 11, 2002
andy
Sep 11, 2002
andy
Sep 12, 2002
Pavel Minayev
Sep 12, 2002
andy
September 10, 2002
Hi I've some code I'm compiling on Linux with DLI, but I wanted to cross test with the DMD compiler.  It seems however (latest version) that the linker hates my guts.  I keep getting this:

D:\d\dmd\samples\d>dmd -v ServerSocket snn.lib -I..\..\..\dm\include\*.c
parse     ServerSocket
semantic  ServerSocket
semantic2 ServerSocket
semantic3 ServerSocket
code      ServerSocket
generating code for function 'this()'
generating code for function 'openSocket'
generating code for function 'bindSocket'
generating code for function 'closeSocket'
generating code for function 'listenSocket'
generating code for function 'acceptSocket'
generating code for function 'readSocket'
generating code for function 'main'
link ServerSocket,,,snn.lib+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _socket
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _bind
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _listen
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _accept
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _htons
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _inet_addr
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _htonl

--- errorlevel 7

I've tried a few variations to try and compile but it never can find the standard C libraries I fear.  Any ideas?  I'm sure I'm doing something minor and stupid.

-Andy

September 10, 2002
andy wrote:

> Hi I've some code I'm compiling on Linux with DLI, but I wanted to cross test with the DMD compiler.  It seems however (latest version) that the linker hates my guts.  I keep getting this:
> 
...
> I've tried a few variations to try and compile but it never can find the standard C libraries I fear.  Any ideas?  I'm sure I'm doing something minor and stupid.

Just don't forget to link with import libs, ws2_32.lib in this case:

  dmd -v ServerSocket snn.lib ws2_32.lib -I..\..\..\dm\include\*.c

If you don't have the lib, you can get it with my winsock module
from my site.


September 11, 2002
Ahh thanks.  URL?

Pavel Minayev wrote:
> andy wrote:
> 
>> Hi I've some code I'm compiling on Linux with DLI, but I wanted to cross test with the DMD compiler.  It seems however (latest version) that the linker hates my guts.  I keep getting this:
>>
> ...
> 
>> I've tried a few variations to try and compile but it never can find the standard C libraries I fear.  Any ideas?  I'm sure I'm doing something minor and stupid.
> 
> 
> Just don't forget to link with import libs, ws2_32.lib in this case:
> 
>   dmd -v ServerSocket snn.lib ws2_32.lib -I..\..\..\dm\include\*.c
> 
> If you don't have the lib, you can get it with my winsock module
> from my site.
> 
> 


September 11, 2002
Okay so I found your site.  And I downloaded the ws2_32.lib however its still reporting negative.  is there another lib I need to support basic functions like bind and accept, etc?

D:\d\dmd\samples\d>dmd -v ServerSocket snn.lib ws2_32.lib -I..\..\..\dm\include\
*.c
parse     ServerSocket
semantic  ServerSocket
semantic2 ServerSocket
semantic3 ServerSocket
code      ServerSocket
generating code for function 'this()'
generating code for function 'openSocket'
generating code for function 'bindSocket'
generating code for function 'closeSocket'
generating code for function 'listenSocket'
generating code for function 'acceptSocket'
generating code for function 'readSocket'
generating code for function 'main'
link ServerSocket,,,snn.lib+ws2_32.lib+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _socket
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _bind
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _listen
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _accept
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _htons
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _inet_addr
ServerSocket.obj(ServerSocket)
 Error 42: Symbol Undefined _htonl

--- errorlevel 7


Pavel Minayev wrote:
> andy wrote:
> 
>> Hi I've some code I'm compiling on Linux with DLI, but I wanted to cross test with the DMD compiler.  It seems however (latest version) that the linker hates my guts.  I keep getting this:
>>
> ...
> 
>> I've tried a few variations to try and compile but it never can find the standard C libraries I fear.  Any ideas?  I'm sure I'm doing something minor and stupid.
> 
> 
> Just don't forget to link with import libs, ws2_32.lib in this case:
> 
>   dmd -v ServerSocket snn.lib ws2_32.lib -I..\..\..\dm\include\*.c
> 
> If you don't have the lib, you can get it with my winsock module
> from my site.
> 
> 


September 11, 2002
andy wrote:

> Okay so I found your site.  And I downloaded the ws2_32.lib however its still reporting negative.  is there another lib I need to support basic functions like bind and accept, etc?
>
> ServerSocket.obj(ServerSocket)
>  Error 42: Symbol Undefined _socket

Judging by mangled function names, you've used extern(C) convention.
Under Windows it should be extern(Windows):

    extern(Windows) int connect(SOCKET s, sockaddr* name, int namelen);

September 11, 2002
Ahh..  I'll try that.  Thanks.

Pavel Minayev wrote:
> andy wrote:
> 
>> Okay so I found your site.  And I downloaded the ws2_32.lib however its still reporting negative.  is there another lib I need to support basic functions like bind and accept, etc?
> 
>  >
> 
>> ServerSocket.obj(ServerSocket)
>>  Error 42: Symbol Undefined _socket
> 
> 
> Judging by mangled function names, you've used extern(C) convention.
> Under Windows it should be extern(Windows):
> 
>     extern(Windows) int connect(SOCKET s, sockaddr* name, int namelen);
> 


September 11, 2002
Thanks!

So looks like I'm down to the last unresolved...  Where would I get htons?

-Andy

Pavel Minayev wrote:
> andy wrote:
> 
>> Hi I've some code I'm compiling on Linux with DLI, but I wanted to cross test with the DMD compiler.  It seems however (latest version) that the linker hates my guts.  I keep getting this:
>>
> ...
> 
>> I've tried a few variations to try and compile but it never can find the standard C libraries I fear.  Any ideas?  I'm sure I'm doing something minor and stupid.
> 
> 
> Just don't forget to link with import libs, ws2_32.lib in this case:
> 
>   dmd -v ServerSocket snn.lib ws2_32.lib -I..\..\..\dm\include\*.c
> 
> If you don't have the lib, you can get it with my winsock module
> from my site.
> 
> 


September 12, 2002
andy wrote:
> Thanks!
> 
> So looks like I'm down to the last unresolved...  Where would I get htons?

It ought to be there as well... How did you declare it?

September 12, 2002
Pavel Minayev wrote:
> andy wrote:
> 
>> Thanks!
>>
>> So looks like I'm down to the last unresolved...  Where would I get htons?
> 
> 
> It ought to be there as well... How did you declare it?
> 

extern (Windows): ushort htons(ushort fd);