Re: Phix: get_struct_size() returns eventually wrong size

new topic     » goto parent     » topic index » view thread      » older message » newer message

My first reaction: as I understand it there should be two bytes of padding after nCopies so that hInstance is aligned on a dword boundary.

Then I found this: https://www.vbforums.com/showthread.php?843083-RESOLVED-Len-LenB-PrintDlg-API-and-the-PrintDlg-structure

Guess I'll have to think about adding some kind of "align" flag to define_struct(), or maybe better if struct_str begins with "#pragma pack(1)"...

OK, I've pushed an updated cffi.e to the repository ( https://raw.githubusercontent.com/petelomax/Phix/master/builtins/cffi.e ) for you to test.
Should you prefer, the diff is here: https://github.com/petelomax/Phix/commit/04144e4fb7092c4321661a3a1d059a1c0cbcb39d
You'll have to insert #pragma pack(1) at the start of the definition of tPD (the blank lines should be optional):

constant tPD=""" 

#pragma pack(1) 
  
typedef struct tagPD {  
... 
""" 

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu