Necessary changes shall be applied to your PowerScript functions, if found in your source code, in order to use the corresponding 64-bit features.
-
If you are passing Structures to External Functions: Using 1-byte structure member alignment in external function (read more)
You can pass PowerBuilder structures to external C functions if they have the same definitions and alignment as the structure's components. The DLL or shared library must be compiled using byte alignment; no padding is added to align fields within the structure.
When you use a structure or structure array as parameters to external function in the older versions of PowerBuilder, the structure member alignment was one byte. However, the default alignment is 8 bytes on Windows platform, which means that most (if not all) Windows standard APIs use this value to align arguments with structure members. This will cause a mismatch between Windows APIs and PB applications in PowerBuilder 12.5 and earlier versions. A well-adopted solution to this issue was to add some bytes within PowerBuilder structures manually to fill those gaps. Such gap filling can be complex and error-prone if involving complex nested structures. And what is worse, this solution fails with the introduction of 64-bit application development in PowerBuilder because the number of bytes you have to fill may be different between 64-bit and 32-bit applications. This was the major reason to make this change in PowerBuilder. The default structure member alignment for Windows APIs and Visual C++ is now on an 8 byte boundary. The structure member alignment was changed to 8 bytes for both 64-bit and 32-bit applications. This was an intentional change so that you can now call Windows APIs easier and use the same code for both 64-bit and 32-bit applications.
Customers can switch to the old behavior in two ways:
-
Check "Use 1-byte structure member alignment in external function" (or set UseZp1=1 in [pb] section, pb.ini, the results are the same). The effect is global with this setting changed. To make this work at runtime, please remember to deploy your pb.ini file with your application.
-
Add "progmapack(1)" external function‘s declaration, like this: FUNCTION int STLAREGIO ( ref struckfzrechnerneu struckfz ) LIBRARY "KFZSS.DLL" alias for "STLAREGIO;Ansi" progma_pack(1)
progmapack(1) is 1-byte alignment, progmapack(8) is an 8-byte boundary (double-word) alignment. These settings only affect an external function declaration‘s alignment usage.
-
-
If you need to use the Registry to store a value of type RegLonLong! then use the following PowerScript function:
RegistrySet ( key, valuename, valuetype, value ) (Source)
valuetype
-
RegLongLong! -- A 64-bit number which is the longlong type ranging from 0 -9,223,372,036,854,775,807, because the registry key value cannot accept a negative number.
-
-
If you need to use the Registry to get a stored value of type RegLongLong! then use the following PowerScript function:
RegistryGet ( key, valuename {, valuetype }, valuevariable ) (Source)
valuetype
-
RegLongLong! -- A 64-bit number which is the longlong type ranging from 0 -9,223,372,036,854,775,807, because the registry key value cannot accept a negative number.
-
-
If you need to convert two Long datatype values into a LongLong datatype, use the following method:
LongLong
Combines two unsigned longs into a longlong value.
Example:
-
UnsignedLong lLow //Low long 32 bits
-
UnsignedLong lHigh //High long 32 bits
-
longlong LLValue //LongLong value 64 bits
-
lLow = 1234567890
-
lHigh = 9876543210
-
LLValue = LongLong(lLow, lHigh)
-
MessageBox("LongLong value", LLValue)
-
Combines two unsigned longs into a longlong value.
-