Hi All,
If any of you wish to use main() with DarkSDK programs you cna use the following code snippet
//a hack to call winmain (inside the DarkSDK lib) from a main()
extern int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdLine, int cmdShow);
// the main func
int main(int argc,char **argv)
{
std::string cmdLine = "";
if(argc > 1)
{
cmdLine = argv[1];
for(int i = 2; i < argc; i ++)
{
cmdLine += " ";
cmdLine += argv[i];
}
}
return WinMain((HINSTANCE)(GetModuleHandle(0)),0,(LPSTR)cmdLine.c_str(),SW_SHOW);
}
this code is a part of a OO wrapper library i am working on for DarkSDK .. It supports automatic reference counted smart pointers so that you do not have to delete any pointer allocated by new.
Also I have added a few handy classes like an Automatic ID generator which generates integer ids and keeps track of which ones have been released and reuses them
IDGen* idGen = ... //the id generator pointer
idGen->generateID(); //returns 1
idGen->generateID(); //returns 2
idGen->generateID(); //returns 3
idGen->releaseID(2);
idGen->generateID(); //returns 2 again
hope to share the code with the community soon...
In Order To Understand Recursion One Must First Understand Recursion