Page 1 of 1

Wrong parameters values in CallFunctionFast

Posted: Wed Jan 27, 2016 8:24 pm
by juankprada
Hi all,

I just tried this little code snippet and found out that the values are being sent (or received) wrong when using CallFunctionFast on a Procedure pointer.

Code: Select all

Procedure MyFunction(interpolation.f, secondVal.f)
	Debug "Interpolation:"+interpolation+" SecondVal:"+secondVal
EndProcedure


Global *funcPointer = @MyFunction()

CallFunctionFast(*funcPointer, 0.12345, 2,34567)

The values i am getting displayed in the debug window are: Interpolation:0 SecondVal:0.0000327568

If I change parameter types of MyFunction to be integer, it works fine.

Re: Wrong parameters values in CallFunctionFast

Posted: Wed Jan 27, 2016 8:28 pm
by wilbert
This is not a bug.
PureBasic help about CallFunctionFast wrote:Note: This function is not very flexible and does not handle string/float/double/quad parameters or string/float/double/quad returns. The use of prototypes is now strongly recommended.

Re: Wrong parameters values in CallFunctionFast

Posted: Wed Jan 27, 2016 8:35 pm
by DontTalkToMe
To say nothing of the fact you are passing three parameters to the called function instead of two.

Re: Wrong parameters values in CallFunctionFast

Posted: Wed Jan 27, 2016 8:44 pm
by juankprada
Right, that was my mistake when typing the code here.

About the note. I didn't noticed it before. I have been using that function passing float parameters in windows without issues. So I guess I forgot to read again the docs.

Still, you are right, is not a bug.