Since a C++ function can dynamically load a function with a C-linked symbol name, which can in turn instantiate a C++ object and return a pointer to it, the extern C functions are provided in each new class. These extern C functions serve as entry points in the shared Teradata PT API library when the library is dynamically loaded. They ensure that objects that are instantiated inside a dynamically loaded library must be deleted inside the same library.
On many UNIX and UNIX-like systems, such as Linux, the application first opens the library, using the dlopen() function and then retrieves the desired symbol with the dlsym() function. When dlsym() finds the symbol, it returns a function pointer that can be used to call the loaded function.
The following is the list of these extern C entry functions to the Teradata PT API library:
- ConnectionX* newConnectionX();
ConnectionX* newConnectionXEncoding (TD_Encoding encoding);
ConnectionX* copyConnectionX (ConnectionX *dest, ConnectionX *src);
void delConnectionX (ConnectionX *object);
- SchemaX* newSchemaX(Char *stype);
SchemaX* newSchemaXEncoding (TD_Encoding encoding);
SchemaX* copySchemaX (SchemaX *dest, SchemaX *src);
void delSchemaX (SchemaX *object);
- DMLGroupX* newDMLGroupX();
DMLGroupX* newDMLGroupXEncoding (TD_Encoding encoding);
DMLGroupX* copyDMLGroupX (DMLGroupX *dest, DMLGroupX *src);
void delDMLGroupX (DMLGroupX * object);