1. Roland Smith
  2. PowerBuilder
  3. Monday, 24 July 2017 15:49 PM UTC

In 12.6 SAP in their infinite wisdom changed the default byte alignment from 1 to 4 without telling anyone. Eventually it was explained somewhere on the SAP forum but I can't find it. It isn't in the Appeon 2017 documentation either.

There is supposed to be something you can add the the declaration but I forgot what it is. All I remember is that it is a misspelling of a C++ keyword that controls byte alignment. Before Appeon gets around to documenting it, I hope they change it to something easier to remember like ByteAlign(n).

 

Roland Smith Accepted Answer Pending Moderation
  1. Monday, 24 July 2017 16:33 PM UTC
  2. PowerBuilder
  3. # 1

I found the post on the SAP forum which I have included a snippet from below.

 

Customers can switch to the old behavior in two ways with PB 12.6 build 4058 and above.

1. Check "Use 1-byte structure member alignment in external function" in Tools, System Options, General page (or set UseZp1=1 in [pb] section, pb.ini, the results are 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.

2.  Add “progma_pack(1)” external function’s declaration, like this.

FUNCTION int STLAREGIO ( ref struc_kfzrechnerneu struc_kfz ) LIBRARY "KFZ_SS.DLL" alias for "STLAREGIO;Ansi" progma_pack(1)

progma_pack(1) is 1-byte align, progma_pack(8) is 8-bytes align.  In this way, the effect is only for external function that is declared with this alignment.

 

And here is one of my replies:

 

I would like to add, progma_pack is a misspelling of the C language compiler directive:

#pragma pack

If SAP actually cared about PowerBuilder, they would have called it something more PB-ish like ByteAlign() and made the default be the behavior that existed before.

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.