How do you pop a retquote?
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi I've got some C code that is called from 4gl and works fine. Now I want to call those same functions from C. The params are being passed on the stack and that works OK pushing them in the caller and popping them in the callee. Now the callee returns values using retquote which I appears to put its values on a different stack. That works fine for 4GL callers but how can I pop these when I call from C? Thanks, Guy Bullen-Smith
Guy Bullen-Smith wrote: > > Hi > > I've got some C code that is called from 4gl and works fine. > > Now I want to call those same functions from C. The params > are being passed on the stack and that works OK pushing them > in the caller and popping them in the callee. > > Now the callee returns values using retquote which I appears to > put its values on a different stack. That works fine for 4GL > callers but how can I pop these when I call from C? There is a way to do this and it is in the 4GL manual, I just don't have time to find it. HOWEVER, sometimes if the horse won't go into the barn it is easier to build a barn around the horse. HUH? Rewrite those 4GL calleable functions as "C" callable and call those from "C" functions. Now rewrite the 4GL calleable functions to call the new "C" functions as well using C calling conventions. In other words always write the functional part of a function for use by 4GL as a C convention funtion then write a 4GL callable wrapper for it. That is the easy way to solve the problem and your C calling functions will not be slowed by having to deal with all that stack stuff. The overhead of having the 4GL wrapper make an additional function call will be minimal compared to the gain for the C functions. Art S. Kagel