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:
you don't need include header. definition of
createthreadnot going change. can copy declaration (and declarations on depends) windows headers own source file.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
Post a Comment