How to simulate bit-fields in Delphi records?

前端 未结 4 2060
终归单人心
终归单人心 2020-12-04 18:32

I would like to declare a record in Delphi that contains the same layout as it has in C.

For those interested : This record is part of a union in the Windows OS\'s L

4条回答
  •  Happy的楠姐
    2020-12-04 18:58

    Rudy's Delphi Corner is the best resource I know of regarding Delphi and C/C++ interoperability. His Pitfalls of conversion is pretty much a must read when using C/C++ APIs in Delphi. The chapter you'll be most interested in is Records and alignment -> Bitfields, but I urge you to read the entire thing top to bottom, twice. The other articles are definitely worth the time investment, too.

提交回复
热议问题