Interfacing to C++: Cannot access value from namespace

Andrew Edwards at
Sat Sep 7 12:53:45 UTC 2019

On Saturday, 7 September 2019 at 12:39:25 UTC, Ali Çehreli wrote:
> On 09/07/2019 03:26 AM, Andrew Edwards wrote:
> > [1] I did not declare any of the other member variables from
> the struct,
> > don't know if this is a source of the problem.
> Yes, it definitely is a problem. The members are accessed as 
> byte offsets into their objects. Without defining the other 
> members, your D-side member is read from offset 0, which is not 
> the case on the C++ side.
> However, I'm still not sure whether that would solve the 
> problem due to the following differences between C++ and D:

That was it, and yes it solves the problem. There are far too 
many variables to define at the moment so I found the offsetof() 
and defined a "void[offset] pad" to take care of the issue for 
right now.


More information about the Digitalmars-d-learn mailing list