It's not FPC that removes them, but the linker.
Indeed. When i compile as
fpc -Aas or
fpc -Awasm i got desired result.
But i can't compile subject sources, because these assemblers exit with errors on instructions like
movl %cx,%edx
...
addl %dx,%edi
...
movw %esi,%dx
...
cmpl %dx,%edi
Although the default assembler build everything fine. I'll try with a Nasm may be...
What are you trying to achieve with your code? Maybe we can help you find a better solution.
That software using Turbo Vision. In this library in order to save and load objects from files (saving current state, language resources) they need to be registered using records of the form
RDialog: TStreamRec = (
ObjType: idDialog; { Register id = 10 }
VmtLink: TypeOf(TDialog);
Load: @TDialog.Load; { Object load method }
Store: @TDialog.Store { Object store method }
);
and RegisterType procedure, like (Free Vision code):
PROCEDURE RegisterDialogs;
BEGIN
RegisterType(RDialog); { Register dialog }
RegisterType(RInputLine); { Register inputline }
RegisterType(RButton); { Register button }
RegisterType(RCluster); { Register cluster }
RegisterType(RRadioButtons); { Register radiobutton }
RegisterType(RCheckBoxes); { Register check boxes }
RegisterType(RMultiCheckBoxes); { Register multi boxes }
RegisterType(RListBox); { Register list box }
RegisterType(RStaticText); { Register static text }
RegisterType(RLabel); { Register label }
RegisterType(RHistory); { Register history }
RegisterType(RParamText); { Register parm text }
RegisterType(RCommandCheckBoxes);
RegisterType(RCommandIcon);
RegisterType(RCommandRadioButtons);
RegisterType(REditListBox);
RegisterType(RModalInputLine);
RegisterType(RListDlg);
END;
In subject sources, unstead of calling hundred+ times of RegisterType, these records (like RDialog before) all are collected in a separate unit and are simply called in a loop:
A: TStreamRec = (...
B: TStreamRec = (...
...more than hundred...
Z: TStreamRec = (...
var
P: PStreamRec;
I: Integer;
begin
P := @A;
I :=Ofs(B) - Ofs(A);
repeat
RegisterType(P^);
Inc(PtrRec(P).Ofs, I);
until PtrRec(P).Ofs > Ofs(Z);
end;
And because here explicitly used just three records, all the rest are missing in the binary obtained by FPC. That my current problem.