32-bit and 64-bit Data Types
While adding 64-bit support to PV-WAVE added greater capability and flexibility, it also presents some unique issues that users should pay careful attention to when operating PV-WAVE in a mixed environment.
SAVE Files
PV‑WAVE uses the platform-independent XDR format when creating PV‑WAVE SAVE files. PV‑WAVE’s current XDR implementation offers 64-bit integer support.
Reading binary XDR data into a PV-WAVE LONG variable in PV-WAVE 64-bit causes 8 bytes to be extracted from the XDR file. In order to read 4 byte values from a binary XDR file you must pass the READ routine a PV-WAVE INT32 variable.
Moving 32-bit PV-WAVE Code to 64-bits
When moving PV‑WAVE code written in 32-bit PV‑WAVE to 64-bit PV‑WAVE, code that performs bit or byte-level manipulation that makes assumptions about the size of a LONG variable must be adjusted for a 64-bit environment. For example, if PV‑WAVE LONGs were converted to a byte array, the size of the byte array would need to be adjusted to get the whole value on a 64-bit platform.
Moving 32-bit OPI or INTERAPP Code to 64-bits
When moving OPI or INTERAPP code written in 32-bits to 64-bits, the code will need to be examined to ensure that INT and LONG C data types have not been used interchangeably. On 32-bit systems, C INTs, LONGs, and pointers are 4 bytes. On a 64-bit non-Windows system, LONGs and pointers become 8 bytes while INTs remain at 4 bytes. So if you are storing a long value or pointer in an INT, it will now be truncated.
The exception to this is Windows 64. On that platform, LONGs are not 8 bytes, while pointers are. To make PV‑WAVE consistent across all platforms, we've defined a new, private data type in the opi_devel.h header file: OPI_long. We define OPI_long to be a LONG on every platform except Windows 64, where it is an INT64.
When developing on Windows 64, replace the LONG data type with OPI_long. This allows your OPI or INTERAPP code to work on Windows 64.
note | It should be noted that the interfaces to the wvh_ or wsdh_ routines (refer to OPI Function Definitions for PV-WAVE Variables on page 325 for a complete list of these routines) did not change. If they took a LONG they still take a LONG and those arguments should not be changed to OPI_longs. |