Oracle 8i Data Cartridge Developer's Guide Release 2 (8.1.6) Part Number A76937-01 |
|
Methods: Using C/C++ and Java , 12 of 13
In future releases, extproc might be a multithreaded process. So, be sure to write thread-safe external procedures. That way, they will continue to run properly if extproc becomes multithreaded. In particular, avoid using static variables, which can be shared by routines running in separate threads. Otherwise, you might get unexpected results.
For help in creating a dynamic link library, look in the RDBMS subdirectory /public, where a template makefile can be found.
When calling external procedures, never write to IN parameters or overflow the capacity of OUT
parameters. (PL/SQL does no runtime checks for these error conditions.) Likewise, never read an OUT
parameter or a function result. Also, always assign a value to IN
OUT
and OUT
parameters and to function results. Otherwise, your external procedure will not return successfully.
If you include the WITH
CONTEXT
and PARAMETERS
clauses, you must specify the parameter CONTEXT
, which shows the position of the context pointer in the parameter list. If you omit the PARAMETERS
clause, the context pointer is the first parameter passed to the external procedure.
If you include the PARAMETERS
clause and the external routine is a function, you must specify the parameter RETURN
(not RETURN
property) in the last position.
For every formal parameter, there must be a corresponding parameter in the PARAMETERS
clause. Also, make sure that the datatypes of parameters in the PARAMETERS
clause are compatible with those in the C prototype because no implicit conversions are done.
A parameter for which you specify INDICATOR
or LENGTH
has the same parameter mode as the corresponding formal parameter. However, a parameter for which you specify MAXLEN
, CHARSETID
, or CHARSETFORM
is always treated like an IN
parameter, even if you also specify BY
REF
.
With a parameter of type CHAR
, LONG
RAW
, RAW
, or VARCHAR2
, you must use the property LENGTH
. Also, if that parameter is IN
OUT
or OUT
and null, you must set the length of the corresponding C parameter to zero.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|