[fpc-devel] Interface: Method resolution clauses

Marcos Douglas md at delfire.net
Mon Apr 30 20:42:54 CEST 2012


On Mon, Apr 30, 2012 at 3:23 PM, Sergei Gorelkin
<sergei_gorelkin at mail.ru> wrote:
> 30.04.2012 20:38, Marcos Douglas пишет:
>>
>>
>> Simple. Does not compile.
>>
> The following compiles successfully (in Win32):
>
> ---------------------------------------------- cut
> {$mode objfpc}{$h+}
> uses activex;
>
> type
>  TMemoryManager = class(TInterfacedObject, IMalloc)
>
>     function IMalloc.Alloc = Allocate;
>     procedure IMalloc.Free = Deallocate;
>     function IMalloc.Realloc = Reallocate;
>     function IMalloc.GetSize = get_size;
>     function IMalloc.DidAlloc = did_alloc;
>     procedure IMalloc.HeapMinimize = heap_minimize;
>
>     function allocate(sz: longword): pointer; stdcall;
>     procedure deallocate(p: pointer); stdcall;
>     function reallocate(p: pointer; sz: longword): pointer; stdcall;
>     function get_size(p: pointer): longword; stdcall;
>     function did_alloc(p: pointer): longint; stdcall;
>     procedure heap_minimize; stdcall;
>  end;
>
> function TMemoryManager.allocate(sz: longword): pointer; stdcall;
> begin
> end;
>
> procedure TMemoryManager.deallocate(p: pointer); stdcall;
> begin
> end;
>
> function TMemoryManager.reallocate(p: pointer; sz: longword): pointer;
> stdcall;
> begin
> end;
>
> function TMemoryManager.get_size(p: pointer): longword; stdcall;
> begin
> end;
>
> function TMemoryManager.did_alloc(p: pointer): longint; stdcall;
> begin
> end;
>
> procedure TMemoryManager.heap_minimize; stdcall;
> begin
> end;
>
> begin
> end.
> ------------------------------------------- cut
>
>
> Sergei

FPC 2.6.1 or 2.7.1 (trunk)?
I'm using 2.6.1 and I can't compile it.

Marcos Douglas



More information about the fpc-devel mailing list