On Tuesday, 29 May 2018 at 01:43:17 UTC, Mike Parker wrote:
In pdf.h, that CAPI macro is used in every function
declaration. That means that on Windows, all of the functions
have the __stdcall calling convention (which, in D, would be
extern(Windows)) and the standard cdecl calling convetion on
other platforms (extern(C) in D).
In the D binding, we see that all of the functions are declared
as extern(C) (line 4 of pdf.d). That means on Windows, the
calling convention on the D side is incorrect.
What you need to do is to change that extern(C) delcaration in
pdf.d to extern(System). This will translate to extern(Windows)
on Windows and extern(C) elsewhere to match the C headers.
this is represented by extern(System) in D which does the
conditional
extern(C) vs extern(Windows) for you.