A script-enabled browser is required for this page to function properly.

ORA_FFI Package

Description

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.

Pass floats through ORA_FFI on Microsoft Windows 3.1

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.

Terminate directory names in LOAD_LIBRARY function calls

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’);

Pass character data to a C function using ORA_FFI

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  ‘;

Procedures and Functions

Ora_Ffi.Ffi_Error

Ora_Ffi.Find_Function

Ora_Ffi.Find_Library

Ora_Ffi.Funchandletype

Ora_Ffi.Generate_Foreign

Ora_Ffi.Is_Null_Ptr

Ora_Ffi.Libhandletype

Ora_Ffi.Load_Library

Ora_Ffi.Pointertype

Ora_Ffi.Register_Function

Ora_Ffi.Register_Parameter

Ora_Ffi.Register_Return

Ora_Ffi.Unload_Library

Ora_Ffi Example 1A

Ora_Ffi Example 1B

Ora_Ffi Example 2