On Tue, Dec 29, 2020 at 05:13:19PM +0000, Arjan via Digitalmars-d-learn wrote: [...] > On the C/C++ side there is no static. I added those on the D side to > to make sure there is no context pointer being added, since that will > change the layout and size of struct. (in the c/c++ code those unions > and structs are nested several levels deep)
You need to add 'static' to the (outer) struct declarations in your unittest block, because otherwise they *will* have a context pointer. This is because unittest blocks are compiled as if they were functions, and struct declarations in a function do acquire context pointers. --T