Link to home
Start Free TrialLog in
Avatar of rbohac
rbohac

asked on

C Conversion

I am going through and doing a .h to delphi conversion so I an use a 3rd party dll.

I'm trying to figure out how to properly convert the following struct. The problem is that there is a data field after the union.. I'm not exactly sure how to do this in Delphi.

typedef struct
{
      ACSEventHeader_t      eventHeader;
      union
      {
            ACSUnsolicitedEvent            acsUnsolicited;
            ACSConfirmationEvent      acsConfirmation;
            CSTARequestEvent            cstaRequest;
            CSTAUnsolicitedEvent      cstaUnsolicited;
            CSTAConfirmationEvent      cstaConfirmation;
            CSTAEventReport                  cstaEventReport;
      } event;
      char      heap[CSTA_MAX_HEAP];
} CSTAEvent_t;

What I have so far:

type CSTAEvent_t = record
  eventHeader : ACSEventHeader_t;
  case Integer of
    0 : (acsUnsolicited: ACSUnsolicitedEvent);
    1 : (acsConfirmation: ACSConfirmationEvent);
    2 : (cstaRequest: CSTARequestEvent);
    3 : (cstaUnsolicited: CSTAUnsolicitedEvent);
    4 : (cstaConfirmation: CSTAConfirmationEvent);
    5 : (cstaEventReport: CSTAEventReport);
  end;

  //How do I add heap : array[1..CSTA_MAX_HEAP] of char;
ASKER CERTIFIED SOLUTION
Avatar of Russell Libby
Russell Libby
Flag of United States of America image

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
Avatar of rbohac
rbohac

ASKER

Excellent. Thank you!