using Unsized Arrays in Structures from d?

NewUser newuser at newuser.com
Fri May 4 13:02:08 UTC 2018


Hi,

How can I use the following c structure from d.

struct Item
{
   int id;
};

struct Group
{
   int i;
   int item_count;
   struct Item items[];
};

tried defining items[] as both "Item[] items" and "Item* items" 
in d, it compiles okay but gives an error when trying to access 
it.

Here is the error.
object.Error@(0): Access Violation
----------------
0x00BCA9D1
0x00BC104C
0x00BD01EB
0x00BD0169
0x00BD0000
0x00BCA827
0x74118654 in BaseThreadInitThunk
0x77534B17 in RtlGetAppContainerNamedObjectPath
0x77534AE7 in RtlGetAppContainerNamedObjectPath


Regards,
NewUser




More information about the Digitalmars-d-learn mailing list