Sybase 12.4.2 Server User Manual


 
CHAPTER 6 Using Procedures and Batches
271
How parameters are passed to the external function
SQL data types are mapped to their C equivalents as follows:
These are the only SQL data types you can use: using others produces an error.
Procedure parameters that are INOUT or OUT parameters are passed to the
external function by reference. For example, the procedure
CREATE PROCEDURE dll_proc( INOUT xvar REAL )
EXTERNAL NAME ’function_name@library.dll’
has an associated C function parameter declaration of
function_name( float * xvar )
Procedure parameters that are IN parameters are passed to the external function
by value. For example, the procedure
CREATE PROCEDURE dll_proc( IN xvar REAL )
EXTERNAL NAME ’function_name@library.dll’
has an associated external function parameter declaration of
function_name( float xvar )
Character data types are an exception to IN parameters being passed. They are
always passed by reference, whether they are IN, OUT, or INOUT parameters.
For example, the procedure
CREATE PROCEDURE dll_proc ( IN invar CHAR( 128 ) )
EXTERNAL NAME ’function_name@library.dll’
has the following external function parameter declaration
function_name( char * invar )
SQL data type C data type
INTEGER long (32 bits)
SMALLINT short
REAL float
CHAR( n ) char *