The ORA_FFI package provides a foreign function interface for invoking C functions in a dynamic library.
Note that float arguments must be converted to doubles. If you must use ANSI declarations, use only doubles within your code.
If the C functions you wish to call using the ORA_FFI have been compiled with an ANSI C compiler, all floating point types should be declared as doubles. Both floats and doubles may be used with a K&R C compiler.
When you specify a library location with the ORA_FFI.LOAD_LIBRARY Built-in subprogram, make sure you terminate the directory location with an ending backslash on Microsoft Windows. On UNIX platforms, you should terminate the directory path with a forward slash.
For example, on Windows:
libhandle := ORA_FFI.LOAD_LIBRARY(‘c:/libraries/’, ‘mylib.dll’);
If you are going to pass character data to a C function, you should initialize it with at least as many characters as the C function will write into it. For example instead of this:
my_string VARCHAR2(20);
use this instead:
my_string VARCHAR2(20) := ’20 characters here ‘;