WEBUTIL_C_API does not work with generic C pointers
(Doc ID 298388.1)
Last updated on OCTOBER 09, 2023
Applies to:
Oracle Forms - Version 10.1.2.0.2 and laterInformation in this document applies to any platform.
Symptoms
========
When using WEBUTIL_C_API.INVOKE_PTR, an ORA-302000 exception is raised.
Cause
=====
The value of a pointer as returned by the Java part of C_API is of the format
oracle.forms.webutil.cApi.CPtr@fd764a0, and not just a number as one would
expect.
Fix
===
From the PL/SQL interface in C_API, access the pointer as if it were a c_long.
1) Use WEBUTIL_C_API.INVOKE_LONG rather than WEBUTIL_C_API.INVOKE_PTR to call
a C function that returns a pointer.
So for
int * getptr()
use
myptr := WEBUTIL_C_API.INVOKE_PTR ('mydll.dll', 'getptr', NULL);
2) Use WEBUTIL_C_API.ADD_PARAMETER (plist, WEBUTIL_C_API.C_LONG,...) rather
than WEBUTIL_C_API.ADD_PARAMETER (plist, WEBUTIL_C_API.C_PTR, ...)
Also be sure to specify WEBUTIL_C_API.PARAM_IN and *not* PARAM_INOUT, as
this would cause attempted pointer dereferencing in C.
So for
void useptr (int *ip)
use
plist := WEBUTIL_C_API.CREATE_PARAMETER_LIST;
mypar := WEBUTIL_C_API.ADD_PARAMETER (plist,
WEBUTIL_C_API.C_LONG,
WEBUTIL_C_API.PARAM_IN,
myptr);
WEBUTIL_C_API.INVOKE ('mydll.dll', 'useptr', plist);
WEBUTIL_C_API.DESTROY_PARAMETER_LIST (plist);
<
Symptoms
When using WEBUTIL_C_API.INVOKE_PTR, an ORA-302000 exception is raised.
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |