On Thursday, 3 December 2020 at 00:58:20 UTC, Paul Backus wrote:
On Thursday, 3 December 2020 at 00:30:06 UTC, Kyle Ingraham
wrote:
// EDSDKTypes.h
typedef struct __EdsObject* EdsBaseRef;
typedef EdsBaseRef EdsCameraListRef;
//
[...]
// edsdk.d
struct EdsBaseRef;
alias EdsBaseRef EdsCameraListRef;
You've dropped a level of indirection here. In the C header,
EdsBaseRef is a pointer, but in your D code, it is an opaque
struct.
The correct way to translate these C declarations into D is:
struct __EdsObject;
alias EdsBaseRef = __EdsObject*;
alias EdsCameraListRef = EdsBaseRef;
Note that unlike C, D does not allow us to refer to an
incomplete type without first declaring it.
That did it. The binding works without issue now. Thanks a ton
for the direction.
I'll keep that distinction between C and D in mind as I go
forward.
It's been night and day between D and C++. I struggled for a
while getting this work going in C++ but was firmly blocked by
CMake. D and dub have been champs for ease of use.