× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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,

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 way.

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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.