Re: Passing variable # of args to C funcs
Posted in 1994
In article <1994Apr1.151657.17897@bme.ri.ccf.org> andrewm@ccfadm.eeg.ccf.org (Martin Andrews) writes: >The 4gl stack structure lets you write C functions that can >receive a variable number of arguments, but the 4gl compiler >complains when two calls to a function from the same file have >a different number of arguments. Otherwise variable number of >arguments seems to work fine. Is there a way to keep the >4gl compiler from complaining about different usages within >a single file? > >I am using 4gl compiler version 4.10. > >-- >Martin Andrews andrewm@ccfadm.eeg.ccf.org >Dept. of Neurology Phone (216)444-7485 >Cleveland Clinic Foundation Fax (216)445-6617 For p-code and c-code use the '-z' flag when compiling. EG: fglpc -z x.4gl c4gl -z x.4gl Note that the c4gl shell script needs to be hacked to recognize the '-z' flag and pass it to the $FGLC part of the script. Otherwise the '-z' will be passed along to the linker. (I recommend against hardcoding the '-z' into the $FGLC call, the basic function call error checking would be bypassed and most of the time functions have fixed numbers of arguments.) Note also that unless you are running the latest versions of fglpc, the fglpc -z works but the generated p-code is bad. As an alternative if you do cross-platform development, p-code files are machine independent so if you have a good fglpc on one machine, use it there and then move your p-code files to the target machine. I do this routinely as the fglpc on my Sun works correctly while the fglpc on another os environment doesn't. This is all documented but I forget where. Scott