Re: External functions in IUS
Posted in 1998
I haven't had a chance to do much server function programming with IUS
yet, but I understand that the rules for passing parameters and return
values are the same as in Illustra (which I have used.) For 4 byte
floating point numbers and anything longer (including doubles) you must
pass the input parameters by reference. Also your return value must be
pointer to double (in this case), and you must allocate the space for
this return value (using mi_alloc) in your function.
Hope this helps,... Mike
Jack G. Clayton wrote:
>
> I'm trying to do something very simple and yet...
>
> In IUS 9.12.UC2 I am creating a function thusly:
>
> create function total (val1 integer, num1 float)
> returning float;> external name '/dir/IUSfuncs.so(IUSfuncs_total)'
> language c
> end function;
>
> My c function is pretty boneheaded:
>
> double IUSfuncs_total (long val1, double num1)
> {
> return (val1 * num1);
> }
>
> After compiling as a shared object, I try to run the following statement
> in dbaccess:
>
> select total(quantity, price) from table;