How to remove unused .CONST data in MASM?
Asked Answered
G

1

7

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.

Gaia answered 4/2, 2012 at 2:36 Comment(0)
C
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.

Cork answered 5/2, 2012 at 2:10 Comment(1)
Well because they're dynamically generated by a macro. I can't really re-create the static library every single time.Gaia

© 2022 - 2024 — McMap. All rights reserved.