|
In addition to the error that Barbara points out here....
All of the fields that are size_t in C should be 10u 0 in RPG. (size_t
in C is unsigned. ssize_t would be signed... but is not used here.)
On 10/14/2014 6:31 PM, Barbara Morris wrote:
On 2014-10-14 15:07, Monnier, Gary wrote:
D regex_t DS qualified
D align based(prototype_only)
Unfortunately, RPG's ALIGN keyword doesn't make the data structure
exactly the same as the C struct. The C data structure's length is a
multiple of its alignment, which is 16 since it contains a pointer. The
RPG data structure doesn't have the extra padding at the end, so it's
smaller than the C struct. The regex functions expect the full length,
and if the additional storage happens to be storage that your program is
using, you can get unexpected results from the regex functions and/or
from using your fields that happen to be where the regex functions think
the end of the struct is.
You could explicitly set the length of the regex_t structure to 640.
Or if you don't want to hard-code the length ...
You could code DIM(1) to get the RPG compiler to define the size of
regex_t as a multiple of its alignmen.
D reg DS likeds(regex_t) dim(1)
And then you'd pass reg(1) instead of reg when you do the call.
Or, since you're not actually using the subfields of regex_t, you could
keep the calls simple by renaming your regex_t to regex_sub_t and then
defining regex_t like this:
D regex_t DS qualified
D align based(prototype_only)
D reg likeds(regex_sub_t) dim(1)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.