// JP opened flex table

Click to See Complete Forum and Search --> : [RESOLVED] Managed unions?


ABuenger
June 21st, 2006, 05:10 PM
value struct myStruct
{
int myInt;
};

union myUnion
{
myStruct iShareMyMemory;
myStruct meToo;
};


Results in the error C2848: 'myUnion::iShareMyMemory' : a managed type cannot be a member of a union.


StructLayout also doesn't seem to work.


Will this be supported with the next release?

joncaves
June 21st, 2006, 05:59 PM
There are supported today - though it is ugly:

using namespace System;
using namespace System::Runtime::InteropServices;

[ StructLayout(LayoutKind::Explicit) ]
public value struct MyUnion
{
[ FieldOffset(0) ]
int data1;

[ FieldOffset(0) ]
String^ data2;

[ FieldOffset(0) ]
Double data3;
};

We have no current plans to 'improve' this support.

//JP added flex table