Hello,
I'm using the following code to "map" (callback fashion) some PureBasic functions in newLisp.
For example:
Procedure.s d4CreateCube(argSize.s, argPosX.s, argPosY.s, argPosZ.s)
... do something ...
EndProcedure
(set 'create-cube dummy1)
(cpymem (pack {ld} 265) (first (dump create-cube)) 4)
(cpymem (pack {ld} @create-cubeADDR) (+ (first (dump create-cube)) 12) 4)
(cpymem (pack {ld} {create-cube}) (+ (first (dump create-cube)) 8) 4)
My problem is I cannot realize a similar thing passing FLOAT as function parameters (d4CreateCube).
Using string or LONG everything works, but with float... my program crashes.
I want to make a PB function as...
Procedure.s d4CreateCube(argSize.f, argPosX.f, argPosY.f, argPosZ.f)
... do something ...
EndProcedure
Even if I talk about PureBasic I can get examples/hints with standard C types :-)
Thank you!
Thank you!
Hi,
newLisp makes a distinction between DOUBLE and FLOAT.
By default newLisp uses DOUBLE internally.
If you need FLOAT in newLisp make sure to cast your value using the (flt) statement.
Hope this helps....
Peter
Thank you for your info!
I will try to work with double, since I want to avoid the users need to make explicit conversion using (float) function.
Thank you.
I will make a post about the results of my tests!
Well, I confirm you are right!
I used double as parameters, and I use "strD()" to convert received double values as string.
Thank you for your help!!!
Good!
BTW, don't get confused with the newLisp (float) statement, in fact this will convert a string or a number to float syntax, but in reality it is a double of 8 bytes.
The (flt) statement however converts a number to a C float which comprises 4 bytes.
Regards
Now I have problems in returning parameter :-(
It seems double does not work. I will try float.
Any results?
Are you using 64bit or 32bit of newLisp?