www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - testing std.socket -- compile/link problem

reply "Chris" <ctlajoie hotmail.com> writes:
hi, i could be missing something obvious here, but this code causes the 
linker to choke for me.

/////
import std.socket;
import std.socketstream;

int main(char[][] args)
{
 TcpSocket sock = new TcpSocket();
 try {
  sock.connect(new InternetAddress("192.168.0.200", 9876));
  SocketStream s = new SocketStream(sock);
 } catch {
  goto stop;
 }
//...

stop:
 sock.shutdown(SocketShutdown.BOTH);
 sock.close();

 return 0;
}
/////

it appears to compile just fine, but i keep getting Error 42's in the 
linker. what am i doing wrong?
the output from dmd and link.exe follows.

chris

C:\Documents and Settings\kaze\Desktop\test>dmd socket_test.d
D:\dmd\bin\..\..\dm\bin\link.exe socket_test,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _gethostbyname 4
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _gethostbyaddr 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _inet_addr 4
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _inet_ntoa 4
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _socket 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _ioctlsocket 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _getsockopt 20
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _bind 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _connect 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _WSAGetLastError 0
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _listen 8
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _accept 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _shutdown 8
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _closesocket 4
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _getpeername 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _getsockname 12
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _send 16
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _sendto 24
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _recv 16
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _recvfrom 24
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _setsockopt 20
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _WSAStartup 8
D:\backup\_programming\D\dmd\dmd\bin\..\lib\phobos.lib(socket)
 Error 42: Symbol Undefined _WSACleanup 0
--- errorlevel 23
Oct 19 2004
parent "Chris" <ctlajoie hotmail.com> writes:
I figured it out.. I just had to link wsock32.lib with it. 
Oct 20 2004