This blog is for users of the gSOAP on OpenVMS software.
The blog has nothing to do with Hewlett-Packard. Content responsibility lies solely with the authors and does not reflect the opinion of their respective employers.
22 November 2010
To align or not to align, that is the question!
All of the gSOAP runtime is compiled with member alignment (and needs to be for various reasons), so if you have code you are integrating with that contains structures that need to be compiled with /nomember_alignment, you will have to be a little careful about how you mix and match; however, aligned and unaligned structures can happily co-exist, if you do things right. What I typically do in this circumstance is to use the following #pragma directives:
#pragma member_alignment save
/* unsligned.h contains structures that need /nomember_alignment (or you could just include the actual structure definitions within
The #pragma directives */
#pragma member_alignment restore
Please ensure that generated gSOAP stubs and code that includes gSOAP header files is compiled with member alignment. Note that you can use the #pragma statements to include in your code structures that are not aligned.
The following brief example might help to illustrate how to adjust for aligned and unaligned structures being mixed in the same program module.