Calling external libraries from procedures

You can call a function in an external library from a stored procedure or function. You can call functions in a DLL under Windows operating systems and in a shared object on Unix. You cannot call external functions on Windows Mobile.

This section describes how to use the external library call API. Sample external stored procedures, plus the files required to build a DLL containing them, are located in the following folder: samples-dir\SQLAnywhere\ExternalProcedures. For information about the location of samples-dir, see Samples directory.

Caution

External libraries called from procedures share the memory of the server. If you call an external library from a procedure and the external library contains memory-handling errors, you can crash the server or corrupt your database. Ensure that you thoroughly test your libraries before deploying them on production databases.

The API described in this section replaces an older API. The older API is deprecated. Libraries written to the older API, used in versions before version 7.0.x, are still supported, but in any new development, we encourage you to use the new API. Note that the new API must be used for all Unix platforms and for all 64-bit platforms, including 64-bit Windows.

SQL Anywhere includes a set of system procedures that make use of this capability, for example to send MAPI email messages. See MAPI and SMTP procedures.