C functions before mainCRTStartup on Mingw?

女生的网名这么多〃 提交于 2020-01-05 12:16:22

问题


void start() {
stuff(); //code before mainCRTStartup
mainCRTStartup();
}
int main()
{
//other code
}

In Visual C++,it compiles fine and function "stuff()" gets called before main. How would call "stuff()" before "mainCRTStartup()"? on Mingw(OS:Windows NT)? it seems to ignore "void start()".


回答1:


You could use the -e argument to ld (the linker) to specify start as your entry point.

I'm not sure how to feed arguments to ld using mingw; perhaps someone can edit my answer to provide that.




回答2:


The real entry point is always start().

start() calls mainCRTStartup() that initializes CRT functions and call main(), so in stuff(), you can not use CRT functions.



来源:https://stackoverflow.com/questions/7948537/c-functions-before-maincrtstartup-on-mingw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!