[SAOC 25] improve importC weekly update 17
Emmanuel
emmankoko519 at gmail.com
Mon Jan 12 12:28:50 UTC 2026
Hi all,
This week I was able to fix building static library with importC
on static functions.
see issue : https://github.com/dlang/dmd/issues/22153.
in my investigations, I realized when static function
redeclarations are encountered where the later one is a
definition, the replacement does wasn't reflecting in backend. so
the backend was always picking the function with no body. I had
to transfer the functions definitions to the declarations for
functions that needed internal linkage and resolutions.
and that fixed it.
see PR:
https://github.com/dlang/dmd/pull/22360#pullrequestreview-3642954373
I tested with several libraries compiling them `-lib`. I also
caught an extra issue that needed fixing. I realized that when
the static function is referenced globally by its address, it is
still not resolved in backend, but when it is referenced by its
address locally, it works fine. this was caught when testing zlib
library that use const initializers to reference functions.
see issue: https://github.com/dlang/dmd/issues/22365.
looking through it and I hope I get it fixed soon.
More information about the Digitalmars-d
mailing list