Re: Call 4gl function from C program
Posted in 1994
> From: alan@po.den.mmc.com (Alan Popiel) > > The 4GL *to* C calling conventions are pretty well documented toward the > end of section 2 of the I4GL Reference Manual - Volume 1; pp. 2-64 ff in > my ver. 4.00 manuals. > > The two details left out for calling 4GL *from* C are: > 1. You use pushxxx() functions to place parameters on the Informix stack. > There is a pushxxx() function for each popxxx() function described in > the manual. > 2. You use the documented popxxx() functions to retrieve your 4GL function's > RETURNING parameters. Thoughtlessly stolen from "INFORMIX 4GL Supplement, Version 4.1", page S-201: Calling a 4GL function from a C program 4GL provideds the Application Programming Interface (API) to let you call 4GL functions from a C program. You can call INFORMIX-4GL C Compiler Version or Rapid Development System Veriosn functions. To write a C program that call 4GL functions, you must do the following: 1. Include the fglapi.h header file. 2. Execute the fgl_start macro to perform initialization tasks. 3. Execute the fgl_call macro to call each 4GL function. 4. If the 4GL function displays forms, execute the fgl_exitfm macro to reset your terminal for character mode. 5. At the end of the program, execute the fgl_end macro to free resources. --------- It then goes on to explain the actual details. But Alan is right, you have to call the push and pop functions to set up the parameters properly. The real hot tip would be to put a C wrapper around the actual 4GL call. Will villy@collinscomp.com