Sybase 12.4.2 manual External function declarations, Following form for Microsoft Visual C++, 270

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 290
Image 290

Calling external libraries from procedures

No other statements permitted

In these statements, function_name is the name of a function in the dynamic link library, and library.dll is the name of the library. The arguments in the procedure argument list must correspond in type and order to the arguments for the library function; they are passed to the external DLL function in the order in which they are listed. Any value returned by the external function is in turn returned by the procedure to the calling environment.

A procedure that calls an external function can include no other statements: its sole purposes are to take arguments for a function, call the function, and return any value and returned arguments from the function to the calling environment. You can use IN, INOUT, or OUT parameters in the procedure call in the same way as for other procedures: the input values get passed to the external function, and any parameters modified by the function are returned to the calling environment in OUT or INOUT parameters.

External function declarations

When an external function is called, a stack is fabricated with the arguments (or argument references in the case of INOUT or OUT parameters) and the DLL is called. Only the following data types can be passed to an external library:

CHARACTER data types, but INOUT and OUT parameters must be no more than 256 bytes in length

SMALLINT and INT data types

REAL and DOUBLE data types

This section describes the format of the function declaration.

For information about passing parameters to external functions, see “How parameters are passed to the external function” on page 271

In the external library, function declarations should follow these guidelines:

Windows NT The function declaration should be of the following form for the Watcom C/C++ compiler:

return-type * __export __stdcall function-name( argument-list )

and the following form for Microsoft Visual C++:

return-type * __declspec(dllexport) __stdcall function-name( argument-list )

270

Page 290
Image 290
Sybase 12.4.2 manual External function declarations, Following form for Microsoft Visual C++, 270