Re: USER EXIT(PL/SQL INTERFACE) problem

From: J. Wegener NOSPAM <xjw_at_xdde.xdk>
Date: Mon, 5 Jul 1999 16:24:55 +0200
Message-ID: <7lqf5e$mad$1_at_news101.telia.com>


[Quoted] Zhao Fu <scip6125_at_leonis.nus.edu.sg> skrev i en nyhedsmeddelelse:7lq7hq$p5b$3_at_nuscc.nus.edu.sg...
> Hi,
>
> I am writing a user exit for a Forms45's button. The code is just
> mimicking a sample code presented in the on-line help(PL/SQL Interface to
> Foreign functions). The testing code is simple: a numerical value is
> passed from the form to the C foreign function, in the C code the number
> is printed into a file. To my surprise, the results are always wrong and
> irregular.
[snip]
> my_func(short my_int)
[snip]
> lh_program:=ora_ffi.load_library(NULL,'myfile.so');
> fh_program:=ora_ffi.register_function(lh_program,'my_func',ora_ffi.C_STD);
> ora_ffi.register_parameter(fh_program,ora_ffi.C_SHORT);
[snip]

[Quoted] I have not dug deeply into you code. But have I noted that you have not registered the return type of your C function (implicit return type int). I guess not registering it might f... up your stack frame causing it to return a "random" value.

[Quoted] Add this call to your package intantiation code, I think that is the missing part:

[Quoted] ora_ffi.register_return(fh_program,ora_ffi.C_INT);

Cheers,
Johan Received on Mon Jul 05 1999 - 16:24:55 CEST

Original text of this message