[fpc-pascal] System's InitializeArray & FinalizeArray

Peter Vreman peter at freepascal.org
Sun Mar 26 20:05:10 CEST 2006


> Hi fpc users!
> I'm here again, with another problem :)
>
> Ok, It's not a problem, per se. It's only a doubt, so, I write here to see
> if you may help me ...
>
> This is the issue:
> In Delphi, I've wrote some code in assembler that calls the above
> mentioned
> routines from System.pas: _InitializeArray & _FinalizeArray, to allow
> initialization and finalization of types that requires it, for generic
> containers which receives only a TypeInfo to indicate the type contained.
>
> the routines' prototype from System.pas are these:
>   procedure _InitializeArray(p: Pointer; typeInfo: Pointer; elemCount:
> Cardinal);
>   procedure _FinalizeArray(p: Pointer; typeInfo: Pointer; elemCount:
> Cardinal);
>
> My code looks like this:
>
> procedure TSilTypeinfoDynamicHandler.Initialize(Data: Pointer; Count:
> Integer);
> asm
>     MOV     EAX, TSilTypeinfoHandler[EAX].FTypeInfo
>     XCHG    EDX, EAX
>     CALL    System. at InitializeArray
> end;
>
> procedure TSilTypeinfoDynamicHandler.Finalize(Data: Pointer; Count:
> Integer);
> asm
>     MOV     EAX, TSilTypeinfoHandler[EAX].FTypeInfo
>     XCHG    EDX, EAX
>     CALL    System. at FinalizeArray
> end;
>
> I need to figure out what to do in FPC, which doesn't have the
> System.InitializeArray and friend.
>
> I've found this (declared in compproc.inc & defined in rtti.inc):
>   fpc_Initialize(Data, TypeInfo)
>   fpc_finalize (Data, TypeInfo)
>
>
> Despite some differences (missing elemCount argument), I need to know how
> to
> call these and if this is going to work at all ...

You need to use Initialize() and Finalize()






More information about the fpc-pascal mailing list