c++ - Extracting specific Win32 functions -


i want use createthread function windows.h, without #defines , crap included in header file. there way import(i think thats called) function .dll or .lib? tested , failed:

#pragma comment(lib,"kernel32.lib") __declspec(dllimport) unsigned long __stdcall waitforsingleobject(     void* hhandle,     unsigned long dwmilliseconds     );   int main() {     waitforsingleobject(0,0); } 

there @ least 2 options:

  1. you don't need include header. definition of createthread not going change. can copy declaration (and declarations on depends) windows headers own source file.

  2. you can write wrappers around windows api functions use, "pimpl" usage of windows api don't have include windows.h , other headers on place.

in opinion, latter option preferable less error-prone, simpler, , provides isolation of nonstandard functions, making easier port code.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -