Why is the Win32 boilerplate the way it is?

Jeremy Sorensen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 30 19:54:18 PDT 2014


On Monday, 30 June 2014 at 15:19:39 UTC, Adam D. Ruppe wrote:
> The Windows headers that come with D are pathetically minimal. 
> You'll need to grab a more complete win32 header OR copy/paste 
> the individual prototypes off MSDN and use them that way.
>
> So add this to your D file after importing 
> core.sys.windows.windows:
>
> extern(Windows)
> void GetStartupInfoA(STARTUPINFO*); // the pathetic druntime 
> Windows headers define TCHAR as ascii, so we'll use the A 
> version
>
>
> And try compiling it. If it complains that STARTUPINFO is 
> undefined too, copy its prototype in:
>
> struct STARTUPINFO {
>   DWORD  cb;
>   LPTSTR lpReserved;
>   LPTSTR lpDesktop;
>   LPTSTR lpTitle;
>   DWORD  dwX;
>   DWORD  dwY;
>   DWORD  dwXSize;
>   DWORD  dwYSize;
>   DWORD  dwXCountChars;
>   DWORD  dwYCountChars;
>   DWORD  dwFillAttribute;
>   DWORD  dwFlags;
>   WORD   wShowWindow;
>   WORD   cbReserved2;
>   LPBYTE lpReserved2;
>   HANDLE hStdInput;
>   HANDLE hStdOutput;
>   HANDLE hStdError;
> }
>
>
> And that should make it work.

Yup that worked



More information about the Digitalmars-d-learn mailing list