Re: sqlexit call under 4GL/ESQL
Posted in 1997
Topics: High Availability & Replication, Connectivity: ESQL/C, 4GL & Embedded SQL
A 4th equall unpleasent option is one that I use (on a unix box) is to use SED to make a change to the '.ec' code before it is passed to the 'C' compiler as follows: c4gl -e foo.4gl <may need -keep to prevent the .ec file from being removed> fix_ec foo.ec c4gl foo.ec -o foo.4ge where fix_ec has: sed s/"fgl_nret = sqlexit(0)"/"sqlexit();fgl_nret=0"/ $1 > tmp mv tmp $1 I'm not sure which method is best, but I already use the fix_ec script to make other changes to allow dynamic page lengths, so adding one more line was no big deal. In article <32D0F9BC.3821@erols.com>, plkapp@erols.com says... > >We have recently made the jump from RDS 4.x (SunOS 4.1/OnLine 5.01) to >RDS6.x (Solaris 2.5/OnLine 7.21) and had some problem with calls to >sqlexit from 4GL. It seems that the new 4GL version of sqlhdr.h will >declare sqlexit as void sqlexit();, but the ESQL version of the same >sqlhdr.h file declares it as int sqlexit(); > >When using c4gl, and the C compiler in ANSI-mode, any program that uses >sqlexit will not compile, since 4gl attempts to assign the return code >to an int variable, but the C compiler is being told that sqlexit does >not return any value. > >It seems we have three options: >1) Edit the sqlhdr.h file and change the return type from void to int >2) Don't set the C compiler flag to compile in ANSI C. This will >prevent __STDC__ from being defined, an the function declaration for >sqlexit (and ALL the function prototypes) will automatically be ifdef'd >away, resulting in the compiler ASSUMING that sqlexit's return type is >int, so the code will compile. >3) Write an esql/c interface program that handles the call to sqlexit >under ESQL/C with the function that returns int. > >A problem with all of these options is the actual linked version of >sqlexit is probably from the 4GL library, not the ESQL library. Can >anybody shed some light as to what is really going on here? > >Paul. >