>From: jacks@opennet.net
>Date: 17 Jan 1997 09:42:04 -0800
>X-Informix-List-Id: <news.32744>
>
>The C program that I am using requires that I pass in some simi-complex
>data structures. It is expecting pointers to those items to be passed in.
>I have created records in Informix, but I don't know how to intermix the
>two. Apparently, the pop functions for retrieving the data from off the
>stack don't seem to handle anthing like this. I really don't want to
>write a trivial wrapper function. Any advice would be appreciated,
You're going to have to write trivial (or not trivial) wrapper functions.
You have to do this for any C code that has to be called from I4GL. Even
such simple system calls as getpid() or maths functions such as qsrt() or
atan2() have to be wrapped, mainly because the I4GL calling convention is
simply incompatible with the normal C calling conventions.
Specifically, you cannot pass whole records into a function. You thought
you can, perhaps, but what is actually passed is simply each record element
in turn. That's why you cannot pass arrays, nor records containing array
elements. So, you are going to have to arrange for a wrapper function
which pops the values off the I4GL stack into actual space in your wrapper
function, then set up the pointers in your structure to point to the actual
space, then call the C function, and then marshall any results back to your
I4GL code. There is no call-by-reference in I4GL (apart from blobs, which
I assume are not under consideration here).
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>