title: Union operation with ctypes doesn't work
body: <p>I have a C struct like this:</p>
  
  <pre><code>typedef struct {
      my_domain_type_t type; 
      my_domain_union_t u;
      my_domain_int32_list_t list;
  } my_domain_value_t;
  
  
  typedef struct {
      int32_t min;
      int32_t max;
  } my_domain_int32_range_t;
  </code></pre>
  
  <p>C function that I'd like to call from ctypes:</p>
  
  <pre><code>int64_t myData::get_min(const my_domain_value_t &amp;value)
  {
      int min_value = 0;
      my_domain_type_t dt = value.type;
  
      if (dt == 0)
      {
          my_domain_int32_range_t range = value.u.range;
          min_value = range.min;
          printf("min_value=%d\n", min_value);
      }
  
      return min_value;
  }
  </code></pre>
  
  <p>ctypes defintions:</p>
  
  <pre><code>class myDomainInt32RangeT(Structure):
      _fields_ = [ ('min', c_long),
                   ('max', c_long) ]
  
  class myDomainUnionT(Union):
      _fields_ = [ ('range', myDomainInt32RangeT ) ]
  
  
  class myDomainValueT(Structure):
      _fields_ = [ ('type', c_int ),
                   ('u', myDomainUnionT ),
                   ('list', myDomainInt32ListT ) ]
  
  class myData(object):
      def __init__(self):
          self.object = myDataX.myData_new()
  
      def get_min(self, arg1):
          myDataX.myData_get_min.argtypes = [ c_void_p, POINTER(myDomainValueT) ]
          myDataX.myData_get_min.restype = c_longlong
          return myDataX.mydata_get_min(self.object, arg1)
  </code></pre>
  
  <p>Python code:</p>
  
  <pre><code>mydataY = myData()
  domainRange = myDomainInt32RangeT()
  domainRange.min = c_long(3)
  domainRange.max = c_long(5)
  domainUnion = myDomainUnionT()
  domainUnion.range = domainRange
  domainValue = myDomainValueT()
  domainValue.type = 0
  domainValue.u = domainUnion
  domainValue.list = myDomainInt32ListT()
  b = mydataY.get_min( byref(domainValue) )
  print(b)
  </code></pre>
  
  <p>I'm expecting a value of 3 for min_value but I keep getting 0. The C code also prints 0. Looks like the union doesn't get setup/transferred correctly.</p>
  
  <p>What did I do wrong ?.</p>
  
  <p>TIA,</p>
  
  <p>John</p>