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

在 Visual C++ 中,它编译得很好,并且函数“stuff()”在 main 之前被调用。如何在“mainCRTStartup()”之前调用“stuff()”?在 Mingw(操作系统:Windows NT)上?它似乎忽略了“void start()”。

4

2 回答 2

0

您可以使用ld(链接器)的 -e 参数来指定start您的入口点。

我不确定如何为ld使用 mingw 提供参数;也许有人可以编辑我的答案来提供。

于 2011-10-30T23:19:29.220 回答
0

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.

于 2012-01-24T16:46:48.553 回答