using winsock2

Don Clugston dac at nospam.com.au
Thu Nov 16 02:52:59 PST 2006


akcom wrote:
> Hello, I'm currently trying to build a project that uses winsock2 (from 
> http://www.prowiki.org/wiki4d/wiki.cgi?WindowsAPI) but I'm having some 
> problems.
> 
> My code is very basic, something along the lines of:
> 
> import win32.core;
> import win32.windows;
> import win32.winsock2;
> 
> void main()
> {
>     WSADATA wsa;
>     WSAStartup( MAKEWORD( 2, 2 ), &wsa );
>     //nothing important
>     WSACleanup();
> }
> 
> I am building it using the following command:
> dmd -IC:\dmd\src\other -version=Win32_Winsock2 main.d ws2_32.lib
> the compiler gives the following complaints:
> main.obj(main)
>  Error 42: Symbol Undefined __init_5win328winsock27WSADATA
> main.obj(main)
>  Error 42: Symbol Undefined _D5win326windef8MAKEWORDFhhZt
> main.obj(main)
>  Error 42: Symbol Undefined WSASTARTUP
> main.obj(main)
>  Error 42: Symbol Undefined WSACLEANUP
> 
> if I add C:\dmd\src\other\win32\winsock2.d to the list of files to compile, 
> I get no complaints about
>  Error 42: Symbol Undefined _D5win326windef8MAKEWORDFhhZt
> 
> any ideas?
Do *NOT* include ws2_32.lib. It's old and very incomplete. To use the 
win32 headers, you need to download the Windows SDK from Microsoft and 
run coffimplib on the .lib files. No-one other than Walter is allowed to 
redistribute the lib files, and he hasn't done it yet, unfortunately. 
(This is something that should definitely be done before D1.0).



More information about the Digitalmars-d-learn mailing list