C and C++ routines
C and C++ routines are external routines that are created by executing a CREATE PROCEDURE, CREATE FUNCTION, or CREATE METHOD statement that references a library built from C or C++ source code as its external code body.
C and C++ routines can optionally execute SQL statements by including embedded SQL statements.
The following terms are important in the context of C and C++ routines:
- CREATE statement
- The SQL language CREATE statement used to create the routine in the database.
- Routine-body source code
- The source code file containing the C or C++ routine implementation that corresponds to the CREATE statement EXTERNAL clause specification.
- Precompiler
- The database utility that pre-parses the routine source code implementation to validate SQL statements contained in the code and generates a package.
- Compiler
- The programming language specific software required to compile and link the source code implementation.
- Package
- The file containing the runtime access path information that the database manager uses at routine runtime to execute the SQL statements contained in the routine code implementation.
- Routine library
- A file that contains the compiled form of the routine source code. In Windows this is sometimes called a DLL, because these files have .dll file extensions.
Before developing a C or C++ routine, it is important to both understand
the basics of routines and the unique features and characteristics
specific to C and C++ routines. An understanding of the Embedded
SQL API and the basics of embedded SQL application development is
also important. To learn more about these subjects, refer to the
following topics:
- External routines
- Embedded SQL
- Include files for C and C++ routines
- Parameters in C and C++ routines
- Restrictions on C and C++ routines
Developing a C or C++ routines involves following a series of step
by step instructions and looking at C or C++ routine examples. Refer
to:
- Creating C and C++ routines
- Examples of C procedures
- Examples of C user-defined functions