From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada interacting with Windows 8.1+ GUI Date: Fri, 26 Oct 2018 10:19:18 +0100 Organization: A noiseless patient Spider Message-ID: References: <5fb88cf6-47da-4c28-a660-9ddf06522b12@googlegroups.com> <5b897611-5e95-4bc8-b5b9-a8df97299cd6@googlegroups.com> <61c2515d-29fd-4b96-8138-88d7f5419fb5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="61a52a3a2bba14e91e699bf7dc753aa2"; logging-data="19029"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dqRKx9w9fTlF/KI/yElaEbkuIPDAWCMk=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:ZRc+39xkA5sjU2/ii4UM07Ei054= sha1:/e/ybuRE9bfalQ0oIhtU6YE2QAg= Xref: reader02.eternal-september.org comp.lang.ada:54713 Date: 2018-10-26T10:19:18+01:00 List-Id: joakimds@kth.se writes: > Isn't it easy for the compiler to optimize away/remove the code that > is not used? Not so much in a library package where some subprograms don't have to be used by the overall program. You can compile with -ffunction-sections -fdata-sections which say each subprogram/data object resp. is to have its own section. If your linker supports (the equivalent of) -gc-sections. linking with it means that only the used sections get linked. This is fine for (arm-eabi) embedded systems & (probably) Linux. which use GNU ld, but not on macOS. Can't say for Windows. GNAT provides gnatelim, which analyses your code and (?) regenerates it without the unused objects. No idea how well this works.