Linktime unresolved reference

donallen donaldcallen at gmail.com
Sun Aug 22 16:57:57 UTC 2021


On Sunday, 22 August 2021 at 15:53:07 UTC, jfondren wrote:
> On Sunday, 22 August 2021 at 15:34:49 UTC, donallen wrote:
>> Any ideas/suggestions?
>
> Does this link?
>
> ```d
> void main() {
>     import std.stdio : writeln;
>
>     writeln(1.0f);
> }
> ```
>
> That's enough to require that symbol:
>
> ```d
> $ dmd havefp.d
> $ nm -D havefp|grep -i 
> _D3std4math8hardware20FloatingPointControl8roundingFNaNbNdNiNeZk
> 0000000000092a70 W 
> _D3std4math8hardware20FloatingPointControl8roundingFNaNbNdN
> ```
>
> If it doesn't link, my guess is that your platform isn't giving 
> std.math.hardware the versions its wants, and perhaps that 
> adding some -version=... flags to your command might get it to 
> compile, and expose what your setup is missing.
>
> If it does link, my only guess is that you're including an .o 
> built by an earlier version of dmd which mangled that 
> differently.

I didn't even bother testing your little code snippet above 
because your guess piqued my interest. I am resurrecting some 
work I had done with D last year and, in particular, I am using a 
library I wrote then providing some utility functions. Forcing a 
full rebuild of that library did the trick. Apparently bit-rot in 
an old .o exactly as you suggested.

Thank you!





More information about the Digitalmars-d mailing list