[fpc-devel]fpgtk problem
KJK::Hyperion
noog at libero.it
Thu Apr 3 01:04:26 CEST 2003
At 17.13 02/04/2003, you wrote:
[...]
>That will not solve the problem. The problem is that there is no knowledge
>how to push an array with X elements of a certain type to a C function.
what? it's the simplest thing in the world. You loop through all the
elements of the TVarRec array, last to first, and push them on the stack,
then you push the formal arguments. Sure, it generates a lot of code, but
it's not that hard. I mean, variable arrays store the length and TVarRec
stores the type of the data, is there something I don't get?
Pseudo code:
var
Integer i, l;
l:= Length(Array);
for i:= l - 1 downto 0 do
Push(Array[i]);
(* known at compile time *)
PushFormalParams();
CallFunction();
(* FormalParamsSize known at compile time *)
Pop(l + FormalParamsSize);
More information about the fpc-devel
mailing list