|
Yeah, Scott - I over- and erroneously stated the matter of passing
structs. I was actually a little surprised that it was passed by value
here. I believe this is not just an IBM i function, so who knows the
history?
And I so agree that going to the docs first is absolutely necessary. The
proverbial butt will thank you forever!!
My post was a bit of a stream-of-consciousness thing, by the way - was
relating what I was finding as I wrote!! So I guessed on the meaning of
iconv_t, then went and looked it up. Hope that wasn't too confusing!! It
was early here!
Vern
Scott Klement wrote:
Hi Vern,way.
I suspect the first parameter is an integer but I don't know for sure -
it's called a conversion descriptor and in the docs has a data type of
iconv_t, so I'd have to go to the QSYSINC/H source file to find what
that is.
in RPG the first parameter should look like this (for those of you who
are too lazy to search for examples)
d iconv_t DS qualified
d based(Template)
d return_value 10I 0
d cd 10I 0 dim(12)
Well, it turns out to be a struct - comprising 1 integer and an array of
12 integers. This has to be by VALUE, because C-structs are passed that
--
It's true that this API expects the structure to be passed by value.
However, it's *not* because "C-structs are passed that way". The vast
majority of structures I've seen used in C are passed by reference.
This one just /happens/ to be passed by value.
Just do what the API is expecting. No need for trial and error, or
doing things wrong just because you have some preconceived notion of how
it should work. Just do what it wants you to do. It'll save you years
of headaches.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.