Skip to content

fpc 3.2.2. OS/2 PMWIN unit

Summary

The {$mode objfpc} switch messes up all integer sizes which implies messing up record sizes as well. For example: types MseMSg, MENUITEM. Consequence is that such records fail to pass their info correctly to other (external) routines.

System Information

  • Operating system: OS/2 Warp 4.52 Merlin (not critical)
  • Compiler version: 3.2.2 (not critical, 2.6.4 has the same issue)
  • Device: <!-- Computer

Steps to reproduce


{typedefs below copied from pmwin}

uses pmwin;

type MENUITEMx = record
        iPosition : integer;
        afStyle : word;
        afAttribute : word;
        id : word;
        hwndSubMenu : cardinal;
        hItem : cardinal;
end;
      
begin
  {my output: 18=wrong 16=OK }
  writeln('pmwin /x sizeof(MENUITEM)  ', sizeof(MENUITEM));
  writeln('local    sizeof(MENUITEMx) ', sizeof(MENUITEMx));
end.

Example Project

What is the current bug behavior?

my output: 18=wrong

What is the expected (correct) behavior?

16

Relevant logs and/or screenshots

Possible fixes

see above. Actually only one line needs the switch: the last function declaration using array of const: Function WinSetErrorInfo(ErrID: ErrorID; Flags: Cardinal; Params: Array of const): ErrorID; external 'pmwin' index 263;

Edited by G Renkema
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information