Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Sv: USER EXIT(PL/SQL INTERFACE) problem

Re: Sv: USER EXIT(PL/SQL INTERFACE) problem

From: Zhao Fu <scip6125_at_leonis.nus.edu.sg>
Date: 6 Jul 1999 17:34:29 GMT
Message-ID: <7lten5$c2p$2@nuscc.nus.edu.sg>


Finally got the code work, two things learnt from the course: 1. don't miss the registeration of the return type of the foreign func. (thank Johan)
2. if the foreign function's parameter is an integer, define it as the binary_integer in the PL/SQL interface. (but don't know why)

Regards,
Fu

J. Wegener NOSPAM (xjw_at_xdde.xdk) wrote:
: 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 Tue Jul 06 1999 - 12:34:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US