Binding Nested C Structs

Craig Dillabaugh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 9 20:38:48 PDT 2015


I am trying to bind to a C union with a number of nested structs 
declared as follows:

typedef union {
     int         Integer;

     struct {
         int     nCount;
         int     *paList;
     } IntegerList;

     struct {
         int     nCount;
         GIntBig *paList;
     } Integer64List;

} OGRField;

According to http://wiki.dlang.org/D_binding_for_C#Nested_Structs
I should attempt to write something like (last example shown):

extern(C) union OGRField
{
    int Integer;
    struct {
       int  nCount;
       int* paList;
    }

    struct {
       int      nCount;
       GIntBig* paList;
    }
}

But that is obviously not going to work.  Does anyone know the 
right way
to handle nested C structs of that form.


More information about the Digitalmars-d-learn mailing list