Hello,
I'm just in the phase of migrating applications from PB 12.5.2 5629 to PB 12.6 4011.
My application uses calls of external functions residing in a C++ DLL with passing structures as arguments.
PB structure:
global type s_s7sbsbulk from structure
boolean bconn
long job
integer machine
integer silo
integer product
long setvalue
long actvalue
integer state
byte manual
end type
C++ struct:
#pragma pack(push, r1, 1)
typedef struct S7SBSBulkData
{
ULONG m_lJobID; // Job-ID
short m_sMachine; // Machine-No. (1 or 2)
short m_sSilo; // Source Silo (1 - 28)
short m_sSiloProduct; // product in silo
ULONG m_lSetValue; // Setvalue in kg
ULONG m_lActValue; // Actual values in kg
short m_sStatus; // Silo-Status
BYTE m_bManual; // manual input
} S7SBSBulkData;
// for GUI (Powerbuilder)
typedef struct S7SBSBLData
{
WORD bConn; // Connection
S7SBSBulkData m_Bulk; // data of loading machine
} S7SBSBLData;
#pragma pack(pop, r1) // stack popped
This worked well for years with PB 12.5.2.
After migrating to PB 12.6 it seems that the alignment of the structure elements in PB has changed.
It seems that each long variable starts now on an address that is a multiple of 4.
PB | C++ | size | PB 12.5.2 address | PB 12.6 address | C++ address |
---|---|---|---|---|---|
bool | WORD | 2 | 0 | 0 | 0 |
long | ULONG | 4 | 2 | 4 | 2 |
int | short | 2 | 6 | 8 | 6 |
int | short | 2 | 8 | 10 | 8 |
int | short | 2 | 10 | 12 | 10 |
long | ULONG | 4 | 12 | 16 | 12 |
long | ULONG | 4 | 16 | 20 | 16 |
int | short | 2 | 20 | 24 | 20 |
byte | BYTE | 1 | 22 | 26 | 22 |
Is this a new feature of PB 12.6 or am I missing something?
Thanks
Werner
PS
This mean that I can't migrate migrate the projects to 12.6 without changing the c++ structures.