On Monday, 26 February 2024 at 12:33:02 UTC, Richard (Rikki) Andrew Cattermole wrote:
On 27/02/2024 1:28 AM, Dakota wrote:
When I use importC to build a c library, there is a lot unused symbol missing.

I try add `-L--gc-sections` to dmd to workaround this issue.

This removes symbols, not keeps them.

You want the linker flag: ``--no-gc-sections``

"Enable garbage collection of unused input sections. It is ignored on targets that do not support this option. The default behaviour (of not performing this garbage collection) can be restored by specifying ‘--no-gc-sections’ on the command line. Note that garbage collection for COFF and PE format targets is supported, but the implementation is currently considered to be experimental."

https://sourceware.org/binutils/docs/ld/Options.html

I need remove symbol, since the problem is some symbol from importC reference to undefined symbol(need to be implement in d, but they will never used).


after remove the unused symbol, I don't need to add the implement all of them.

  • importC with gc... Dakota via Digitalmars-d-learn
    • Re: importC... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: imp... Dakota via Digitalmars-d-learn

Reply via email to