www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [SAOC 25] improve importC weekly update 17

reply Emmanuel <emmankoko519 gmail.com> writes:
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.
Jan 12
parent reply Emmanuel <emmankoko519 gmail.com> writes:
On Monday, 12 January 2026 at 12:28:50 UTC, Emmanuel wrote:
 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.

 [...]
All issues with building static libraries with static functions in importC fixed. link to PR : https://github.com/dlang/dmd/pull/22387#event-21999041568
Jan 14
next sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Wednesday, 14 January 2026 at 10:22:02 UTC, Emmanuel wrote:
 On Monday, 12 January 2026 at 12:28:50 UTC, Emmanuel wrote:
 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.

 [...]
All issues with building static libraries with static functions in importC fixed. link to PR : https://github.com/dlang/dmd/pull/22387#event-21999041568
Thanks again for all your work here. Have tried using TensorFlow C API with importC?
Jan 14
parent Emmanuel <emmankoko519 gmail.com> writes:
On Wednesday, 14 January 2026 at 12:59:40 UTC, jmh530 wrote:
 On Wednesday, 14 January 2026 at 10:22:02 UTC, Emmanuel wrote:
 On Monday, 12 January 2026 at 12:28:50 UTC, Emmanuel wrote:
 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.

 [...]
All issues with building static libraries with static functions in importC fixed. link to PR : https://github.com/dlang/dmd/pull/22387#event-21999041568
Thanks again for all your work here. Have tried using TensorFlow C API with importC?
No I haven’t, and I will actually see to it that it gets tested also.
Jan 14
prev sibling parent reply Serg Gini <kornburn yandex.ru> writes:
On Wednesday, 14 January 2026 at 10:22:02 UTC, Emmanuel wrote:
 link to PR : 
 https://github.com/dlang/dmd/pull/22387#event-21999041568
Nice. Was it tested on all major platforms? As a potential idea - is to have a separate "importC CI" which will test different types of building (including static) with GitHub Actions
Jan 14
parent Emmanuel <emmankoko519 gmail.com> writes:
On Wednesday, 14 January 2026 at 13:59:06 UTC, Serg Gini wrote:
 On Wednesday, 14 January 2026 at 10:22:02 UTC, Emmanuel wrote:
 link to PR : 
 https://github.com/dlang/dmd/pull/22387#event-21999041568
Nice. Was it tested on all major platforms? As a potential idea - is to have a separate "importC CI" which will test different types of building (including static) with GitHub Actions
I actually have a simple setup in my GitHub for testing importC libraries. I’m now about to fetch some libraries that I’ve tested locally and then move them there with dmd-current. At least I think I have been able to clear some basic and important needed fixes. See here : https://github.com/Emmankoko/importC
Jan 14