description Cross platform C++ WinMain


//-------------------------------------------
int main(int argc, char** argv)
//-------------------------------------------
{
    /*
        Example:

        App app;
        app.run(argc, argv);

        This how I do it. 
        I have a class App where
        I handle the arguments 
        in my run() function.
        You could also tokenize 
        them here and pass a list
        to keep your run function clean.
    */
}

#ifdef _WINDOWS
#include "Windows.h"

//----------------------------------------------------
int CALLBACK WinMain(_In_ HINSTANCE hInstance, 
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPSTR lpCmdLine, 
                     _In_ int nCmdShow)
//----------------------------------------------------
{
    return main(__argc, __argv);
}
#endif // #ifdef _WINDOWS

tweet gist  •  August 23 2019