Unix替代此mingw运行时代码
Unix alternative to this mingw runtime code
MinGW使用此代码作为每个程序的启动
static void __attribute__((noreturn)) __mingw_CRTStartup (void)
{
int nRet;
SetUnhandledExceptionFilter (_gnu_exception_handler);
_fpreset ();
_mingw32_init_mainargs ();
_mingw32_init_fmode ();
_pei386_runtime_relocator ();
asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
nRet = main (_argc, _argv, environ);
_cexit ();
ExitProcess (nRet);
}
对于终止所有线程并处理返回值的行ExitProcess(nRet);
,Linux有什么替代方案?在哪里可以找到Linux/OSX gcc运行时的源代码?Linux GCC/XCode运行时是否终止所有线程?如果没有,它如何处理main的返回值?
对应的代码,在"glibc"中比上面的MingW代码复杂一点(因为它有很多选项,其中既有编译瓦片,也有运行时选项):
http://sourceware.org/git/?p=glibc.git;a=斑点;f=csu/libc start.c;h=a14ed71616a3f63f092837e9c30780f8344b4be;hb=cvs/glibc-2_9分支
然而,简单的观点是:
result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
exit (result);
是的,exit
将杀死所有线程(如果没有其他操作,则当在_exit()
中调用退出的系统调用时,操作系统将杀死。
相关文章:
- 我在c++代码中生成了一个运行时#3异常
- 为什么此代码存在运行时错误?
- C++程序打开时立即运行的代码
- 如何在 android ndk 上链接 C 和 C++ 代码,以及 C 和 C++ 运行时库(包括 STL)?
- 蝴蝶代码 88.合并排序数组 c++ 运行时错误
- 在Hackerearth上获取运行时错误(SIGSEGV),无法找出代码中的问题
- 为什么我的代码在运行时保持循环
- 为什么我在此代码中收到运行时错误
- C++:此代码可以编译,但引发运行时检查失败 #2 - 围绕变量周围的堆栈'num'已损坏。发生
- LLvm Jit:如何从抖动代码中取消引用运行时指针?
- 与shared_ptr相比,更小的运行时数据结构和更快的代码可实现独特的_ptr
- 我的代码上的运行时错误 sigsegv
- 矢量的 c++ 代码中的运行时错误
- C++代码在 for 循环的条件下给出运行时错误,而如果它被具有相同意义的代码替换,则编译正确
- C++/LLVM:运行时代码生成和STL容器
- 执行生成运行时代码的递归模板
- Netbeans C/C++ on Linux "step in to" Linux C 运行时代码?
- 用于将 C# 运行时代码编译为本机程序集代码(可从C++应用程序调用)中的.dll的方法
- Unix替代此mingw运行时代码
- 以0符号表示的运行时代码