Bug in OPTLINK?

David L. Davis SpottedTiger at yahoo.com
Wed Jun 13 10:43:34 PDT 2007


WeirdCat,

   I did the follwing below and it compiles fine with dmd v1.015 on WinXP SP2 (32-bit)...so I don't think it's the linker.

Install as follows:
-------------------
C:\dmd\test
   testme.d (renamed from test.d to testme.d)
        |->Lib
           win32.lib
        |->Win32
           winsock2.d

Note: Windows' environment variable "Path" has the below added
set path=%path%;C:\dm\bin;c:\dm\include;c:\dm\lib;C:\dmd\bin;C:\dmd;
           
Windows' Commanline (cmd.exe running in C:\dmd\test):  
-----------
dmd testme.d win32\winsock2.d ws2_32.lib (compiles, with no errors)
dmd testme.d win32\winsock2.d (compiles, with no errors)
         
Code:
-----
//--- testme.d ---
module testme; // added
private import win32.winsock2; // changed some

pragma(lib, "Ws2_32.lib"); // line 3 - uncommented

int main(char[][] args) 
{
	WSADATA wd;	   // line 6 - uncommented
	WSAGetLastError();
	return 0;
}         

//--- winsock2.d ---
module win32.winsock2;
pragma(lib, "Ws2_32.lib");

alias ushort WORD;

const size_t
	WSADESCRIPTION_LEN = 256,
	WSASYS_STATUS_LEN  = 128;

struct WSADATA 
{
	WORD   wVersion;
	WORD   wHighVersion;
	char[WSADESCRIPTION_LEN+1] szDescription;
	char[WSASYS_STATUS_LEN+1]  szSystemStatus;
	ushort iMaxSockets;
	ushort iMaxUdpDg;
	char*  lpVendorInfo;
}

extern(Windows) int WSAGetLastError();

David L.


More information about the Digitalmars-d-learn mailing list