Datatypes like Long/Ulong need to be changed in order to support 64-bit.
LongPtr is not a full-fledged PowerBuilder data type because there are no pointer operations in PowerBuilder. You can use it to hold/pass window handles, database handles, and other objects that are essentially memory addresses, but complex operations on LongPtr type might not work.
In PowerBuilder 32-bit applications, LongPtr is the same as Long/ULong, and you can use Long/ULong wherever LongPtr is required. In 64-bit applications, misuse of data types may lead to data truncation (for example, from 8 bytes to 4 bytes) or memory corruption.
Follow the suggestions below to change Long/ULong to LongPtr or LongLong for 64-bit applications:
-
If you are passing a Long ref variable when a LongPtr ref is required, change Long/ULong to LongPtr.
-
In complex operations that represent/compute 8-byte long integers, change Long/ULong to LongLong. LongLong is for 64-bit signed integers, from -9223372036854775808 to 9223372036854775807. Keep in mind that LongLong continues using literals as integers, but longer numbers are permitted.
-
When declaring PowerBuilder functions for using external APIs, if any of the following condition is met, change Long/ULong to LongPtr:
-
The PowerBuilder function uses Long or ULong to correspond with the pointer-type parameter or return value of an external API (that is, the functions’ source definition);
-
The PowerBuilder function uses Long or ULong to correspond with the 64-bit parameter or return value of an external API;
-
The PowerBuilder function uses Long or ULong to correspond with the Handle type return value of an external API.
-