Link to home
Start Free TrialLog in
Avatar of rbohac
rbohac

asked on

c++ data type to Delphi

I'm going through a c++ header file converting data types and I am stuck on this one.. Anybody know how to translate this to Delphi?

typedef union RhtFeatureValue_u
{
    ULONG                   Integer;         // integer values (char, short, int, long)
    ULONG                   Enumeration;     // enumerated types
    ULONG                   BitMap;          // bit-mapped values

    UCHAR                   Reserved[16];    // Maximum of 128 bits.
} RHT_FEATURE_VALUE_U, *PRHT_FEATURE_VALUE_U;
Avatar of Evarest
Evarest

This should be it (not 100% sure about RHT_FEATURE_VALUE_U)

PRhtFeatureValue = ^TRhtFeatureValue;
TRhtFeatureValue = record
 int: ULONG;
 Enumeration: ULONG;
 Bitmap: ULONG;
 Reserved: array [0..15] of char; // or string[16];
end;

Hope this helps,
Evarest
Avatar of rbohac

ASKER

Since it's a union type (and not a struct), shouldn't is look something like:

TRhtFeatureValue = record
  case integer of....
If i look at the following thread, I didn't think that the case integer of is needed...

https://www.experts-exchange.com/questions/11378818/C-to-Pascal-Delphi-translation.html

I don't really know...
Evarest
Sorry, my mistake. rbohac gets the points as he correctly stated that the case integer of is needed. See for example:

https://www.experts-exchange.com/questions/20952048/union-type-in-C-header-conversion.html?query=typedef+union&topics=85

Kind regards,
Evarest
ASKER CERTIFIED SOLUTION
Avatar of vadim_ti
vadim_ti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial