using winsock2

akcom CppCoder at gmail.com
Thu Nov 16 09:22:55 PST 2006


Before I had been using implib on ws2_32.dll, now that I used coffimplib, I 
get the following linking errors:

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

main.obj(main)
 Error 42: Symbol Undefined __init_5win328winsock27WSADATA
main.obj(main)
 Error 42: Symbol Undefined WSASTARTUP
--- errorlevel 2
"Don Clugston" <dac at nospam.com.au> wrote in message 
news:ejhfuc$1eid$1 at digitaldaemon.com...
> 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