I was wondering, is there any nice way to use the builtins __argc and __argv (like in Visual C++) in MinGW (I'm including windows.h already), or will I have to do something more involved to access these parameters. I'd so very much like to just have this code work in MinGW (but we don't always get what we wish for):
#include <windows.h>
extern int main(int argc, char* argv[]);
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
{
return main(__argc, __argv);
}
These aren't "builtins," they are global variables provided by the C Runtime. They are declared in <stdlib.h>
in both the Visual C++ library headers and in Stephan's MinGW distro. If they aren't declared in your copy of <stdlib.h>
, just declare them yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With