On Monday, 4 January 2021 at 17:24:27 UTC, Steven Schveighoffer
wrote:
On 1/3/21 9:17 PM, bdh wrote:
On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole
wrote:
Your definition of Image is probably wrong.
You may have missed a pointer (8 bytes).
[...]
How to test:
in D-land:
import magickd.core.c.image : Image;
pragma(msg, Image.filename.offsetof);
In C-land
#include <stdio.h>
#include <magick/image.h>
int main()
{
Image *ptr = NULL;
printf("%ld", &(ptr->filename)); // may need a different
specifier
}
If those are not the same, then your struct is off.
-Steve
Thanks for this, I wasn't aware of the .offsetof property (I see
it's mentioned in the Struct and Unions section of the language
reference).
As rikki guessed, I had missed something (offset was 480 instead
of 488). The issue wasn't with the Image struct itself, but with
the TimerInfo struct (used for the `timer` member of Image)
missing a "private" unsigned long.
Thanks again.