Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove unused .CONST data in MASM?

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.

like image 436
user541686 Avatar asked Feb 04 '12 02:02

user541686


1 Answers

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.

like image 155
Gunner Avatar answered Sep 28 '22 07:09

Gunner