Re: Call 4gl function from C program
Posted in 1994
->From: rjk@world.std.com (Robert J. Kolker) ->Subject: Call 4gl function from C program ->Date: Sun, 13 Mar 1994 20:13:14 GMT ->Reply-To: rjk@world.std.com (Robert J. Kolker) ->Organization: The World Public Access UNIX, Brookline, MA -> ->I mistated a question in a prior posting. I am using informix 4.10 4gl on ->Sun OS and I wish to call a 4gl program from a C program. How might I do ->that. -> ->Thanx -> ->Bob Kolker 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. An easy way to construct the appropriate calling sequence is to write a dummy 4GL function to call the 4GL function that you want to call from C. Then compile the dummy 4GL and copy the generated C-code into your own C module. If you plan to use 4GL subfunctions called from C functions, I strongly recommend that you have a 4GL main program. The 4GL main program does several things to set up the environment expected by 4GL functions. It's cheap, easy, and safe to write a 4GL wrapper that does nothing but call the "real" C main program, which is no longer named "main", of course. Regards, Alan ___________________________ ______________________| R. Alan Popiel |__________________________ \\ Internet: | Martin Marietta, SLS | / \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. / )Voice: | Denver, CO 80201-0179 USA | ( / 303-977-9998 |___________________________| (But you knew that!) \\ /________________________) (____________________________\\