In the file exe_common.inl, crt call main function like this:
static int __cdecl invoke_main()
{
return main(__argc, __argv, _get_initial_narrow_environment());
}
However, if I call main in my program with three auguments, C2660 error will occur.
just like:
#include <iostream>
using namespace std;
int index{ 10 };
int argv{ 1 };
char** argc{ NULL };
char* env{ NULL };
int main(/*int argc, char** argv, char* env*/)
{
cout << "index=" << index << endl;
if (index != 0)
{
index--;
main(argc, argv, env);
}
}
I am so curious about the startup code, so thank you for you answer.