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


  • Subject: Re: API parameter lengths
  • From: bmorris@xxxxxxxxxx
  • Date: Thu, 12 Jul 2001 18:20:26 -0400
  • Importance: Normal

>Date: Wed, 11 Jul 2001 15:56:01 -0500
>From: "Larry Loen" <lwloen@us.ibm.com>
>
>
>Steve Richter wrote:
>
>   So Larry, does the C pgm make a copy of the string before
>   it null terminates it?
>
>I would expect it does.  Remember that to follow the C conventions, the
>"first" parameter (argv[0] in C terms) is the name of the program, so a
>copy is likely anyway since the second parm on main is an array of arrays.
>This would be most unlikely to match the original OS/400 calling
>conventions, which is a series of strings and, possibly, even decimal
>numbers
...
> ...Still, this is why
>I think this is part of why I mentioned (in passing) the command
processor.
>It seems to understand some of these things.

Larry is right that it's the command processor that handles the
the null-termination when a call is made from the command line; I think
it's only for character parameters; I know that numeric parameters are
passed as usual as decimal(15,5), whether or not they get an extra x'00'
tacked onto the end.

What the C pep does is copy the parameters (which are all pointers by
AS/400 convention, no matter what type they point to) to an array of
pointers, starting with an extra pointer to a string containing the
program name.  Then the pep calls 'main' with the argument count and
the array of pointers.  It doesn't mess with what the pointers are
pointing to at all.

Barbara Morris

+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.