Hello,
on the marked line will throw an exception. The same on Deplphi works well
#pragma hdrstop #pragma argsused #include #include #include #include // Enable RTTI generation for private fields #pragma explicit_rtti fields(private) typedef char TShortString[20]; class __declspec(delphirtti) TBuffer : public TObject { private: int wrHead, rdHead; TShortString name; // ... public: TBuffer() : wrHead(42), rdHead(43) { strcpy (name, "Buffer"); } }; // --------------------------------------------------------------------------- int _tmain(int argc, _TCHAR* argv[]) { TRttiContext context; TBuffer * buffer = new TBuffer; TRttiType* rttiType = context.GetType(buffer->ClassType()); TRttiInstanceType *cls2 = dynamic_cast(rttiType); DynamicArray fieldArray = cls2->GetDeclaredFields(); for (int i = 0; i < fieldArray.Length; i++) { TRttiField *field = fieldArray[i]; printf("Property name : '%S', ", field->Name); TValue value = field->GetValue(buffer); printf("kind : '%u', ", value.Kind); if (value.IsArray()) { for (i = 0; i < value.GetArrayLength(); i++) { TValue item = value.GetArrayElement(i); /// <<< exception } } else { //printf("type : '%S', ", field->FieldType->ToString()); printf("value: '%S'", value.ToString()); } printf("\n"); } delete buffer; return 0; }