Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: USER EXIT(PL/SQL INTERFACE) problem
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]
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.
Add this call to your package intantiation code, I think that is the missing part:
ora_ffi.register_return(fh_program,ora_ffi.C_INT);
Cheers,
Johan
Received on Mon Jul 05 1999 - 09:31:28 CDT
![]() |
![]() |