| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 50 人关注过本帖
标题:如何让编译生成的C程序小于1KB
取消只看楼主 加入收藏
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1946
专家分:3019
注 册:2009-12-22
结帖率:89.13%
收藏
 问题点数:0 回复次数:0 
如何让编译生成的C程序小于1KB
程序代码:
#include <windows.h>
void _start() {
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    const char msg[] = "Hello World\n";
    DWORD written;
    WriteFile(hOut, msg, 12, &written, NULL);
    ExitProcess(0);
}


编译:

gcc -Os -ffunction-sections -fdata-sections -nostartfiles -fno-asynchronous-unwind-tables -fno-stack-protector -fomit-frame-pointer -Wl,--gc-sections,--entry=_start,--strip-all,--image-base=0x400000,--file-alignment=256 -lkernel32 main.c -o hello_win.exe


生成的文件还是无法在1KB之内,如何优化,可以让编译生成1KB以内?

图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 小于 main 生成 gcc 编译 
昨晚 19:59
快速回复:如何让编译生成的C程序小于1KB
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017957 second(s), 12 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved