It is very unlikely that you will be able to do this work, at least as it is written. Dissatisfied ads are taken from the FPC runtime. You will also need to bind this or reinstall it in Delphi. None of the options are viable.
, Classes , , , . , , , , FPC, - . , .
FPC. FPC .
FPC Delphi. FPC:
unit unit1;
interface
implementation
function Test(i: Integer): Integer; cdecl;
begin
Test := i*42;
end;
end.
:
fpc unit1.pp
Delphi :
{$APPTYPE CONSOLE}
{$L 'unit1.o'}
function Test(i: Integer): Integer; cdecl;
external name 'UNIT1_TEST$SMALLINT$$SMALLINT';
begin
Writeln(Test(666));
end.
:
27972
, . , objdump:
>objdump -d unit1.o
unit1.o: file format pe-i386
Disassembly of section .text.n_unit1_test$smallint$$smallint:
00000000 :
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 04 sub $0x4,%esp
6: 0f bf 45 08 movswl 0x8(%ebp),%eax
a: 6b c0 2a imul $0x2a,%eax,%eax
d: 66 89 45 fc mov %ax,-0x4(%ebp)
11: 66 8b 45 fc mov -0x4(%ebp),%ax
15: c9 leave
16: c3 ret
...
x86- . , x64 .
, FPC , . , - FPC , , .