digitalmars.D.learn - Linker issues with DMD and LDC
- Thomas Gregory (21/24) Nov 12 2021 I get this error when trying to compile a program using
I get this error when trying to compile a program using [dhtslib](https://github.com/blachlylab/dhtslib) with DMD or any LDC version < 1.25.0. ``` _D39TypeInfo_S7dhtslib3sam6record9SAMRecord6__initZ: error: undefined reference to `_D7dhtslib3sam6record9SAMRecord15__fieldPostblitMFNbNiNlNeZv' ``` Though I only experience this when trying to create an array of `SAMRecord`s. One solution I have found is using `std.array.Appender` instead of arrays. Another solution I have found is to define an explicit postblit for `SAMRecord`, though the implicitly generated postblit should work. Looking through ldc changelogs, the closest thing I could attribute this to is this change for ldc-1.25.0:- Struct TypeInfos are emitted into referencing object files only, and special TypeInfo member functions into the owningI posted this question [previously](https://forum.dlang.org/post/flpztfooingrpkxano j forum.dlang.org), though I explained the problem poorly. I don't understand why my fixes work or what is causing the issue in the first place. Is there something I should be doing differently? Is this a compiler or language bug?
Nov 12 2021