Hey. I have a service program in RPGLE that has a procedure that returns a value (10 characters). Can someone explain how to declare this procedure in a C program to get the return value?
Announcement
Collapse
No announcement yet.
Call RPGLE from a C program
Collapse
X
-
Scott, you probably misunderstood me. I need to call a procedure in C code, which is in a service program written in RPG. Here is a synthetic example of a procedure in a service program:
And this is a C program in which a procedure from a service program is called and in which I need to get what the procedure returns:Code:D SomeFoo pr 10 EXTPROC('SomeFoo') D param1 10A const PSomeFoo B export DSomeFoo pi 10 D param1 10A const * C clear ret 10 C movel 'Text from' ret C param1 dsply C return ret C pSomeFoo e
In this example, in C, the service program works, since when the SomeFoo procedure is called, the line passed in the procedure parameter appears in the job log. However, I cannot get the information that the procedure returns to me.Code:char* SomeFoo(char*); int main() { char* ptr; ptr = SomeFoo("asdfg "); // Here ptr doesn't get any meaning }
Comment
-
Scott, you probably misunderstood me. I need to call a procedure in C code, which is in a service program written in RPG. Here is a synthetic example of a procedure in a service program:
And this is a C program in which a procedure from a service program is called and in which I need to get what the procedure returns:Code:D SomeFoo pr 10 EXTPROC('SomeFoo') D param1 10A const PSomeFoo B export DSomeFoo pi 10 D param1 10A const * C clear ret 10 C movel 'Text from' ret C param1 dsply C return ret C pSomeFoo e
In this example, in C, the service program works, since when the SomeFoo procedure is called, the line passed in the procedure parameter appears in the job log. However, I cannot get the information that the procedure returns to me.Code:char* SomeFoo(char*); int main() { char* ptr; ptr = SomeFoo("asdfg "); // Here ptr doesn't get any meaning }
Comment



Comment