Wrong parameters values in CallFunctionFast

Mac OSX specific forum
juankprada
User
User
Posts: 62
Joined: Tue Mar 18, 2014 4:25 pm
Location: Bogotá, Colombia

Wrong parameters values in CallFunctionFast

Post 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.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Wrong parameters values in CallFunctionFast

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
DontTalkToMe
Enthusiast
Enthusiast
Posts: 334
Joined: Mon Feb 04, 2013 5:28 pm

Re: Wrong parameters values in CallFunctionFast

Post by DontTalkToMe »

To say nothing of the fact you are passing three parameters to the called function instead of two.
juankprada
User
User
Posts: 62
Joined: Tue Mar 18, 2014 4:25 pm
Location: Bogotá, Colombia

Re: Wrong parameters values in CallFunctionFast

Post 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.
Post Reply