From: K. F. <kfr...@gm...> - 2012-05-15 13:07:27
|
Hello Ruben! On Tue, May 15, 2012 at 8:37 AM, Ruben Van Boxem <van...@gm...> wrote: > 2012/5/15 K. Frank <kfr...@gm...> > >> Hi Joshua! >> >> On Tue, May 15, 2012 at 3:54 AM, Joshua Boyce >> <rap...@ra...> wrote: >> > On Tue, May 15, 2012 at 1:08 AM, K. Frank <kfr...@gm...> 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 |