从海湾合作委员会MinGW的ANDD删除不需要的code [英] removing unneeded code from gcc andd mingw

查看:134
本文介绍了从海湾合作委员会MinGW的ANDD删除不需要的code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,MinGW的增加了很多code的调用的main(),我认为它,因为这些功能之一解析命令行参数被称为__getmainargs(),还大量字符串被添加到最终的可执行文件之前,如mingwm.dll和一些错误字符串(柜面应用程序崩溃)说MinGW的运行错误或类似的东西。

i noticed that mingw adds alot of code before calling main(), i assumed its for parsing command line parameters since one of those functions is called __getmainargs(), and also lots of strings are added to the final executable, such as mingwm.dll and some error strings (incase the app crashed) says mingw runtime error or something like that.

我的问题是:有没有办法删除所有这些东西?我不需要这些东西,我试过TCC(微型C编译器),它做的工作。但像GCC不是跨平台(的Solaris / MAC)

my question is: is there a way to remove all this stuff? i dont need all these things, i tried tcc (tiny c compiler) it did the job. but not cross platform like gcc (solaris/mac)

什么想法?

感谢。

推荐答案

是的,你真的的需要所有这些事情。他们是在启动和拆除code为您code在运行C的环境。

Yes, you really do need all those things. They're the startup and teardown code for the C environment that your code runs in.

除了非托管环境中,如低级别的嵌入式解决方案,你会发现pretty多的所有的ç环境有类似的东西。比如像 /lib/crt0.o 下的一些类UNIX操作系统或 crt0.obj Windows下。

Other than non-hosted environments such as low-level embedded solutions, you'll find pretty much all C environments have something like that. Things like /lib/crt0.o under some UNIX-like operating systems or crt0.obj under Windows.

他们是你的code的成功运行是至关重要的。你可以自由省略不使用(的printf ABS 等)的库函数,但启动$需要C $角

They are vital to successful running of your code. You can freely omit library functions that you don't use (printf, abs and so on) but the startup code is needed.

部分的的,它可以执行的 atexit对结构的初始化,参数解析,对于C运行时库结构的初始化,初始化的事的C / C ++ pre-主要价值等等。

Some of the things that it may perform are initialisation of atexit structures, argument parsing, initialisation of structures for the C runtime library, initialisation of C/C++ pre-main values and so forth.

这是非常特定于操作系统的,如果有你不想做的事情,你可能就必须得到源$ C ​​$ C它和带他们出去,在本质上提供自己切下更换为对象文件

It's highly OS-specific and, if there are things you don't want to do, you'll probably have to get the source code for it and take them out, in essence providing your own cut-down replacement for the object file.

这篇关于从海湾合作委员会MinGW的ANDD删除不需要的code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆