This unit has {$mode objfpc} on top which changes (in this case: messes up) integer sizes, and hence record sizes. E.g. MENUITEM, MSEMSG. Fix can be simple IMHO: move {$mode objfpc} down to where it is needed: just above last declaration before implementation.