如何将结构中的C union转换为Delphi

Pha*_*tom 2 delphi

我需要帮助将此C类型声明转换为Delphi:

typedef struct _IO_STATUS_BLOCK {
  union {
    NTSTATUS Status;
    PVOID    Pointer_;
  } ;
  ULONG_PTR Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
Run Code Online (Sandbox Code Playgroud)

Ond*_*lle 9

Hardlinks.pasJCL:

type
  IO_STATUS_BLOCK = record
    case integer of
      0:
       (Status: NTSTATUS);
      1:
       (Pointer: Pointer;
        Information: ULONG); // 'Information' does not belong to the union!
  end;
  // PIO_STATUS_BLOCK = ^IO_STATUS_BLOCK;
Run Code Online (Sandbox Code Playgroud)


Mih*_*șan 5

除了其他帖子,您可能还想阅读转换陷阱.Rudy的文章是关于Delphi/C/C++互操作性的信息的金矿.