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 to all.
>> ...
> Yes, as long as you add a __declspec(dllimport) to the function declaration
> and also link in the appropriate import library.

I don't follow about linking to an (additional) appropriate import library.
Presumably I am already linking correctly when I include windows.h
and use Sleep in my code.  Correct me if I'm wrong, but including
windows.h shouldn't automatically be causing me to link any differently.

> Oh, you will also need an 'extern "C"' to prevent name mangling afaik.

Yes, that sounds right.

> Boost for example manually declares and imports all the Windows APIs it uses
> unless you define BOOST_USE_WINDOWS_H. If you want to check out what they're
> doing as a confirmation what you're doing is correct I believe their
> wrappers are in boost/detail/win.

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 in
advance?

I appreciate your help.


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