mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 11:18:18 +02:00

shifted all the parameters on the stack. Now the 'self' parameter is declared as var, not const, restoring its original value is not necessary anymore git-svn-id: trunk@15744 -
43 lines
654 B
ObjectPascal
43 lines
654 B
ObjectPascal
program tintfcdecl2;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
type
|
|
IcdeclIntf = interface
|
|
['{3C409C8B-3A15-44B2-B22D-6BAA2071CAAD}']
|
|
function DoSomething : longint; cdecl;
|
|
end;
|
|
|
|
{ TcdeclClass }
|
|
|
|
TcdeclClass = class(TInterfacedObject,IcdeclIntf)
|
|
private
|
|
FCounter: integer;
|
|
public
|
|
function DoSomething : longint; cdecl; virtual;
|
|
end;
|
|
|
|
{ TcdeclClass }
|
|
|
|
function TcdeclClass.DoSomething: longint; cdecl;
|
|
begin
|
|
inc(FCounter);
|
|
result := FCounter;
|
|
end;
|
|
|
|
var
|
|
js: TcdeclClass;
|
|
ji: IcdeclIntf;
|
|
i: longint;
|
|
begin
|
|
js := TcdeclClass.Create;
|
|
|
|
i := js.DoSomething;
|
|
|
|
ji := IcdeclIntf(js);
|
|
i := ji.DoSomething;
|
|
|
|
if i <> 2 then halt(1);
|
|
end.
|
|
|