[fpc-pascal] System's InitializeArray & FinalizeArray

Leandro Conde lconde at str.com.ar
Sat Mar 25 20:35:12 CET 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 ... 

Thanks you again!
See ya!
Leo.




More information about the fpc-pascal mailing list