Pregunta

So I am writing a wrapper for main and still provide a main like functionality, so user can define int main() or int main(argc, argv) and both works fine. I am able to do that for some compilers with inline assembly with pushing argc & argv onto stack before calling the user's main. However for x64 VC++, there is no inline assembly, so any suggestions on how I can achieve this?

Thanks!

¿Fue útil?

Solución

I see two obvious choices: either write your code in assembly language, contained in an assembly language file, or else write your code in C++ without any inline assembly:

void my_entry_point() { 
     int argc = foo();
     int argv = bar();
     int ret = main(argc, argv);
     exit_to_os(ret);
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top