How to remove unused .CONST data in MASM?

孤者浪人 提交于 2019-12-23 08:52:19

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9137956/how-to-remove-unused-const-data-in-masm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!