如何删除MASM中未使用的.CONST数据? [英] How to remove unused .CONST data in MASM?

查看:52
本文介绍了如何删除MASM中未使用的.CONST数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MASM中使用宏来生成大约2000个函数,为每个函数定义了一个字符串,但是在任何给定程序中我只使用了大约30个函数.

I'm using macros in MASM to generate about 2000 functions, for each of which I define a string, but I only use around ~30 of them in any given program.

(无法预测我会提前使用哪些;我会根据需要使用它们.)

(There is no way to predict which ones I will use ahead of time; I use them as needed.)

有什么办法告诉链接程序淘汰"我最终不使用的字符串?他们将二进制文件的大小炸了很多.

Is there any way to tell the linker to "strip out" the strings that I don't end up using? They blow up the binary size by quite a lot.

推荐答案

为什么不将这2000个函数和字符串放入静态库中?将proc公开,并使用externdef作为字符串,然后将exe链接到lib时,链接器将仅拉入所使用的字符串和proc.

Why don't you just put those 2000 functions and strings into a static library? Make the procs public, and use externdef for the strings, then when you link your exe to the lib, the linker will only pull in the strings and procs that are used.

这篇关于如何删除MASM中未使用的.CONST数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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