|
Also, you forgot the RETURN VALUE on your RPG prototype. Your C
prototype returns an int -- but the RPG side shows no return value.
Change it to have 10i 0 as a return value, otherwise those 4 bytes that
are returned could possibly be overwriting memory used for something
else -- and that might be hard to catch in testing, but could result in
the dreaded "unexpected results" in production.
I have a C procedure called by an RPG program:
In the RPG program, it is prototyped thusly:
D FOO PR EXTPROC('foo')
D * VALUE OPTIONS(*STRING)
D * VALUE OPTIONS(*STRING)
D 10I 0 VALUE
D * VALUE OPTIONS(*STRING)
D * VALUE OPTIONS(*STRING)
and called thusly:
C CALLP FOO(X,Y,I,K,BUFFY)
and the C procedure is:
int foo(char *opcode, char *filename, int len, char *key, char *buffy) {
/* here we read a record from a file, putting the record into buffy */
A printf() statement in the C procedure tells me that the record
definitely gets read from the file, and it's definitely the right
record. Yet when control returns to the calling program, the record is
gone, and what was originally in BUFFY is back.
Obviously, I'm doing *something* wrong here.
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.