PB 6.10 beta 5 #PB_Any return value type changed?

Just starting out? Need help? Post your questions and find answers here.
Justin
Addict
Addict
Posts: 956
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB 6.10 beta 5 #PB_Any return value type changed?

Post by Justin »

It's not the PB Integer type, i know that, all my code is x64/x86 compatible since very long ago.

It's a particular case i came along that made me notice this:
I am interacting with the WebView2 javascript, when you pass in a gadget handle returned by #PB_Any to a js function, it's interpreted differently by javascript depending on the PB linker used:
New Linker: The value becames #VT_R8 (8 bytes floating point)
Old Linker: The value becames #VT_I4 (4 bytes signed)

These causes some issues because i'm passing the value back to PB via libffi so the PB function value has to be declared with the correct type depending on the os.
The workaround is to convert all VT_I4 types to VT_R8 when calling a PB function from javascript and declare them as doubles, it works but i was wondering if it would make more sense to have the same memory behaviour in all os. Anyways my problem is fixed.
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB 6.10 beta 5 #PB_Any return value type changed?

Post by mk-soft »

Use VT_I8 for x64 Pointers and Id's
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Justin
Addict
Addict
Posts: 956
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB 6.10 beta 5 #PB_Any return value type changed?

Post by Justin »

Hi mk,

i already tried, it does not work. When you get a value back from javascript anything bigger than a long it's considered a double. In js the number type is double, so if you call a pb function from js like:

pbobj.pbfunc(2147483648)

the pb function recieves a double not a 8 byte integer because that number exceeds the max long value.
I just convert longs to doubles before calling pb functions, it works.
Post Reply