On Sunday, 31 October 2021 at 03:51:49 UTC, James Blachly wrote:
On 10/29/21 7:10 AM, Stanislav Blinov wrote:
On Friday, 29 October 2021 at 11:05:14 UTC, Imperatorn wrote:
On Thursday, 28 October 2021 at 01:39:10 UTC, Thomas Gregory wrote:
I am a maintainer of the [dhtslib](https://github.com/blachlylab/dhtslib) package and I have been running into issues with a new implementation of reference counting we are using.

[...]

Postblit?

https://dlang.org/spec/struct.html#struct-postblit

I imagine Imperatorn is quite familiar with postblit and was pointing out that it is strange to use postblit constructor, which is deprecated, in a "new implementation".

The original post was long and really buried the lede, but OP was pointing out what looks like a compiler bug: a linker error referencing a postblit symbol only shows up when compiling with DMD or with LDC earlier than 1.25.

Can someone give some insight?

I apologize for the long-winded question.

Postblit?

Yes, one solution would be to add a postblit.

However, the compiler should be able to generate default postblit and it does. I am only running into issues linking, which leads me to believe this is a compiler or language bug (fixed as of ldc-1.25).

Is there some way to to avoid writing an explicit postblit for every struct that uses `SafeHtslibPtr`? Many of `dhtslib`'s structs wrap c type pointers that are reference counted and owned by `SafeHtslibPtr` like so:

```D
// wrappedCPtr is an alias defined in another module as:
alias wrappedCPtr = SafeHtslibPtr!(c_type, destroy_c_type_fun);

// It is imported here
struct WrapperTypeName
{
    /// Backing C type pointer
    wrappedCPtr b;
...
}
```





Reply via email to