[fpc-pascal] Gecko / Firefox / XPCOM

Flávio Etrusco flavio.etrusco at gmail.com
Fri May 22 03:07:25 CEST 2009


On Thu, May 21, 2009 at 5:34 PM, Henrik Genssen
<henrik.genssen at mediafactory.de> wrote:
> (...)
> nsMemory.pas(155,13) Warning: Some fields coming before "GetMem" weren't initialized
> nsMemory.pas(157,17) Warning: Some fields coming before "ReallocMem" weren't initialized
> nsMemory.pas(157,17) Error: Incompatible types: got "Realloc(Pointer, LongInt):^untyped" expected "<procedure variable type of function(var Pointer, LongInt):^untyped;Register>"
> nsMemory.pas(165) Fatal: There were 1 errors compiling module, stopping
>
> for the following costruct - stopping at the line ReallocMem:
>
> const
>  memmgr: TMemoryManager = (
>    GetMem: Alloc;
>    FreeMem: Free;
>    ReallocMem: Realloc;
>  );
> procedure SetToMemoryManager;
> begin
>  SetMemoryManager(memmgr);
> end;
>
> how can that be done in FPC?
>
> regards
>
> Hinnack

You must either set Delphi compiler mode - {$mode Delphi} - or get a
reference/pointer to the functions Alloc, Free and Realloc (prefix
them with the @ operator).
BTW, it looks like you're accessing the TMemoryManager declaration
from System.pp/SysInit (? heaph.inc), is it what you intended?

Best regards,
Flávio



More information about the fpc-pascal mailing list