www.digitalmars.com         C & C++   DMDScript  

D - DMD: LINK!!! Please link!

reply andy <acoliver apache.org> writes:
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
Sep 10 2002
parent reply Pavel Minayev <evilone omen.ru> writes:
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.
Sep 10 2002
next sibling parent andy <acoliver apache.org> writes:
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.

Sep 10 2002
prev sibling next sibling parent reply andy <acoliver apache.org> writes:
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.

Sep 10 2002
parent reply Pavel Minayev <evilone omen.ru> writes:
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);
Sep 10 2002
parent andy <acoliver apache.org> writes:
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);

Sep 11 2002
prev sibling parent reply andy <acoliver apache.org> writes:
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.

Sep 11 2002
parent reply Pavel Minayev <evilone omen.ru> writes:
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?
Sep 11 2002
parent andy <acoliver apache.org> writes:
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);
Sep 12 2002