[fpc-pascal] PascalScript / FPC: parameters problems (need internals gurus I think)
Alexandre Leclerc
alexandre.leclerc at gmail.com
Tue Aug 8 20:39:55 CEST 2006
Hi all,
I hope some have knowledge of PascalScript because I'm having quite a
weird and complex problem. I'll demonstrate it here very simply so if
some have ideas...
*Problem*
I'm exporting some classes (originally a TBitmap; now a custom class)
to the ROPS engine and then interacting with the class in the
scripting engine. Everything works, except for some functions that
behave very strange. They skip/duplicate the parameters and invert
parameters.
*Simple example*
All the following code is typed in the e-mail.
TMyClass
public
procedure DrawRectangle(left, top, right, bottom: Extended);
end;
//
procedure TMyClass.DrawRectangle(left, top, right, bottom: Extended);
begin
ShowMessage('left='+FloatToStr(left)+' top='+FloatToStr(top)+
' right='+FloatToStr(right)+' bottom='+FloatToStr(bottom));
end;
//
var
MyClass: TMyClass; //I create it later
Now I call a function in the script defined as procedure
OnMyClass(myclass: TMyClass); Then I pass the class in parameters.
*Example of script*
procedure OnMyClass(myclass: TMyClass);
begin
myClass.DrawRectangle(1,2,3,4);
end;
*Results of all that*
We would expect to have a nice message displaying 'left=1 top=2
right=3 bottom=4', but in fact I'm getting 'left=4 top=3 right=2
bottom=2'. So parameter order is reversed and I'm always loosing the
first (last!?!) parameter and the second one is duplicated to the
first.
The ROPS units are compiled in delphi mode in there units. My
application is pure fpc. I'm under winXP.
I'm still doing many other tests meanwhile.
Best regards.
--
Alexandre Leclerc
More information about the fpc-pascal
mailing list