System's InitializeArray & FinalizeArray

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

System's InitializeArray & FinalizeArray

Leandro Conde
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.@InitializeArray
end;
 
procedure TSilTypeinfoDynamicHandler.Finalize(Data: Pointer; Count:
Integer);
asm
    MOV     EAX, TSilTypeinfoHandler[EAX].FTypeInfo
    XCHG    EDX, EAX
    CALL    System.@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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: System's InitializeArray & FinalizeArray

Peter Vreman
> 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.@InitializeArray
> end;
>
> procedure TSilTypeinfoDynamicHandler.Finalize(Data: Pointer; Count:
> Integer);
> asm
>     MOV     EAX, TSilTypeinfoHandler[EAX].FTypeInfo
>     XCHG    EDX, EAX
>     CALL    System.@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()



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal