Informix / C parameter passing
Posted in 1993
My thanks to Jonathan Leffler, for his comments about parameter passing. It appears to me that this is EXTREMELY 4gl-version dependent. Once again, here is the 4GL for my empty function, followed by the C generated by the version 2.10 compiler. empty.4gl --------- FUNCTION empty ( a, b, c ) DEFINE a, b CHAR(256), c CHAR(512), d CHAR(512) RETURN d empty.c (produced by version 2.10 c4gl) ------- #include <sqlhdr.h> #include <sqlfm.h> #line 1 "empty.ec" #include <decimal.h> #include <stdio.h> extern struct { long sqlcode; char sqlerrm[ 72 ]; char sqlerrp[ 8 ]; long sqlerrd[ 6 ]; char sqlawarn[ 8 ]; } sqlca; #line 8 "empty.ec" extern int status; #line 9 "empty.ec" extern int efcode; extern int int_flag; #line 11 "empty.ec" extern int quit_flag; #line 12 "empty.ec" static char *fgl_modname = "empty.4gl"; empty (fgl_pcnt) int fgl_pcnt; { #line 17 "empty.ec" char a[ 257 ], b[ 257 ]; #line 18 "empty.ec" char c[ 513 ]; #line 19 "empty.ec" char d[ 513 ]; #line 20 "empty.ec" if (fgl_pcnt != 3) fgl_fatal(fgl_modname, 6, -4501); popquote(c,513); popquote(b,257); popquote(a,257); pushquote(d,512); doretalloc(1); return(1); } #line 28 "empty.ec" Perhaps in version 2.10 the 'doretalloc' call served the 'retquote' purpose. I don't know: It's your (Informix's) code generator. I chose not to use it, and the function still works. I stand by my statement to compile empty.4gl and then modify my function to use the same sort of calling and return sequences that you find in the resulting empty.c. Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, Tech Ops | / \\ alan@den.mmc.com | P.O. Box 179, M/S 5422 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\