Hello Ruben!

On Tue, May 15, 2012 at 8:37 AM, Ruben Van Boxem
<[email protected]> wrote:
> 2012/5/15 K. Frank <[email protected]>
>
>> Hi Joshua!
>>
>> On Tue, May 15, 2012 at 3:54 AM, Joshua Boyce
>> <[email protected]> wrote:
>> > On Tue, May 15, 2012 at 1:08 AM, K. Frank <[email protected]> wrote:
>> >>
>> >> By the way, a quick semi-related question:  To use native windows
>> >> Sleep I am including windows.h.  It's not a big deal, but it does
>> >> increase the compile time of simple test programs noticeably.
>> >> (Not really a lot, though.)  Would anyone know off-hand if I can
>> >> just put in two or three lines of prototype declarations for Sleep
>> >> instead of including all of windows.h?
>> >> ...
>> Thanks.  I should be able to sort this out by rummaging through
>> mingw-w64's windows.h and the boost headers.  But any hints in
>> advance what the sleep declaration might end up looking like?
>
> http://msdn.microsoft.com/en-us/library/ms686298%28v=vs.100%29.aspx

Yeah, per your msdn link:

   VOID WINAPI Sleep(
     __in  DWORD dwMilliseconds
   );

and per mingw-w64's winbase.h:

   WINBASEAPI VOID WINAPI Sleep(DWORD dwMilliseconds);

I sort of knew that already.  But it's the "VOID" and "WINAPI" and
"DWORD", etc that I need to rummage through the headers to
translate properly.

Well ...  After some rummaging I came up with:

extern "C" {
  __declspec(dllimport) void __stdcall Sleep (unsigned long dwMilliseconds);
}

How does that look?  It seems to work.

And it shaves about six seconds (about 40%) off of the compilation
time of a small, three-file test program.  (Oh, well ...  Less time to
read xkcd ...  http://xkcd.com/303/)

Thanks.


K. Frank

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to