Chapter 3. API

Table of Contents

3.1. Overview
3.2. tdlcall
3.3. tdlcall2
3.4. tdlcall2v
3.5. tdlcall2s
3.6. tdlcallva
3.7. tdlcallva2
3.8. tdlcreate
3.9. tdldestroy
3.10. tdlerror
3.11. tdlgetseqno
3.12. tdlstart
3.13. tdlend
3.14. tdlsuspend
3.15. tdlresume
3.16. tdlclose
3.17. tdlload
3.18. tdlload2
3.19. tdlinit
3.20. tdldone
3.21. tdlfind
3.22. tdlfind2
3.23. tdlstat
3.24. tdlstat2

This chapter describes how to use APIs to develop applications.

3.1. Overview

TDL APIs are included in the Tmax server or client libraries and must include the tdlcall.h header file. The Tmax server supports only TCS and UCS types. Clients do not support multi threaded libraries with them. The following is a list of TDL APIs.

APIDescription
tdlcallCalls the latest version of a dynamic module function. Can be used when VERSION is set to 1 or 2 in the TDL environment file.
tdlcall2Calls the latest version of a dynamic module function. Can be used when VERSION is set to 3 in the TDL environment file.
tdlcall2vCalls the latest version of a dynamic module function. Can be used when VERSION is set to 3 in the TDL environment file.
tdlcall2sCalls the latest version of a dynamic module function. Can be used when VERSION is set to 3 in the TDL environment file.
tdlcallvaCalls the latest version of a dynamic module function. Can be used when VERSION is set to 1 or 2 in the TDL environment file.
tdlcallva2Calls the latest version of a dynamic module function. Can be used when VERSION is set to 3 in the TDL environment file.
tdlcreateCreates class instances by using Class Factory in the latest version of a dynamic module. Can be used when VERSION is set to 4 in the TDL environment file(tdl.cfg).
tdldestroyDestroys class instances by using Class Factory in the latest version of a dynamic module. Can be used when VERSION is set to 4 in the TDL environment file(tdl.cfg).
tdlerrorWhen an error for tdlcall() occurs, convert it into a string form.
tdlgetseqnoGets the Global Sequence number.
tdlstartStarts keeping the explicit version consistency.
tdlendEnds keeping the explicit version consistency.
tdlsuspendSuspends keeping the version consistency.
tdlresumeResumes keeping the version consistency which was suspended.
tdlcloseInitializes the reference count of the module to zero or directly removes the module from the memory.
tdlloadLoads modules into a shared memory. Can be used when VERSION is set to 1 or 2 in the TDL environment file(tdl.cfg).
tdlload2Loads modules into a shared memory. Can be used when VERSION is set to 3 in the TDL environment file(tdl.cfg).
tdlinitConfigures the shared memory initially.
tdldoneInitializes the shared memory.
tdlfindFinds module index. Can be used when VERSION is set to 1 or 2 in the TDL environment file(tdl.cfg).
tdlfind2Finds module index. Can be used when VERSION is set to 3 in the TDL environment file(tdl.cfg).
tdlstat

Outputs TDL statistics information. Can be used when VERSION is set to 1 or 2 in the TDL environment file(tdl.cfg).

MONITOR must be set to Y.

tdlstat2

Outputs TDL statistics information. Can be used when VERSION is set to 3 in the TDL environment file(tdl.cfg).

MONITOR must be set to Y.

3.2. tdlcall

The latest version of a dynamic module function is called. This dynamic module function must have a long funcname(void *args) signature. A tdlcall function works only when the version of a TDL configuration file(tdl.cfg) is set to 1 or 2. Dynamic modules are loaded when a tdlcall() is called, and to prevent performance deterioration, they are recycled unless an update (tdlupdate) is required.

  • Prototype

    #include <tdlcall.h>
    int tdlcall(char *funcname, void *args, long *urcode, int flags)
  • Parameter

    ParameterDescription
    funcnameThe name of dynamic module. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    argsAn argument to a dynamic module function being called.
    urcodeA return value from a dynamic module function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS will be set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error in an environment configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

3.3. tdlcall2

The tdlcall2 function calls the latest version of a dynamic module using a library name and function name as a key. This dynamic module must have a long funcname(void *args) signature. Other than the use of a library name and function name as a key, this function is identical to a tdlcall() function.

A dynamic module function must have a long funcname(void *args) signature. This function is available only when the version of a TDL configuration file (tdl.cfg) is set to 3.

  • Prototype

    #include <tdlcall.h>
    int tdlcall2(char *libname, char *funcname, void *args, long *urcode, int flags)
  • Parameter

    ParameterDescription
    libnameThe library name of a dynamic module. (Maximum size : TDL_FUNCNAME_SIZE – 1)
    funcnameThe function name of a dynamic module. (Maximum size : TDL_FUNCNAME_SIZE – 1)
    argsAn argument to a calling dynamic module function.
    urcodeA return value from a dynamic module function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, TDL_NOFLAGS is set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

3.4. tdlcall2v

The tdcall2v function calls the latest version of a dynamic module using a library name and a function name as a key. This dynamic module must have a long funcname(int argc, char *argv[]) signature.

Other than the use of a library name and a function name as a key, this function is identical to a tdlcall() function and is available only when the version of a TDL configuration file (tdl.cfg) is set to 3.

  • Prototype

    #include <tdlcall.h>
    int tdlcall2v(char *libname, char *funcname, int argc, char *argv[], 
                 long *urcode, int flags)
  • Parameter

    ParameterDescription
    libnameThe library name of a dynamic module. (Maximum Length : TDL_FUNCNAME_SIZE – 1)
    funcnameThe function name of a dynamic module.(Maximum Length : TDL_FUNCNAME_SIZE – 1)
    argcThe number of arguments for a dynamic module function.
    argvAn argument vector for a dynamic module function..
    urcodeA return value from a dynamic module function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS is set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

3.5. tdlcall2s

The tdcall2s function calls the latest version of a dynamic module using a library name and a function name as a key. This dynamic module must have a long funcname(void *input, void *output) signature.

Other than the use of a library name and a function name as a key, this function is identical to a tdlcall() function. This function is available only when the version of a TDL configuration file (tdl.cfg) is set to 3.

  • Prototype

    #include <tdlcall.h>
    int tdlcall2s(char *libname, char *funcname, void *input, void *output, 
                  long *urcode, int flags)
  • Parameter

    ParameterDescription
    libnameThe library name of a dynamic module. (Maximum length: TDL_FUNCNAME_SIZE – 1).
    funcnameThe function name of a dynamic module. (Maximum length: TDL_FUNCNAME_SIZE – 1).
    inputAn input buffer pointer to a calling dynamic module function.
    outputAn output buffer pointer to a calling dynamic module function.
    urcodeThe return value from a dynamic module function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS is set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

3.6. tdlcallva

The tdlcallva function calls the latest version of a dynamic module using a function name as a key. A parameter is sent as-is for a dynamic function module that has an unfixed prototype. Delivered arguments must all have a <void *> pointer type. In a dynamical module function, all delivered parameters must be created as <void *> pointer types.

This function can be used when VERSION=1 or VERSION=2 is specified in a TDL configuration file(tdl.cfg).

  • Prototype

    #include <tdlcall.h>
    int tdlcallva(char *funcname, long urcode, int flags, int rettype, void *retval, 
                  int argc, …);
  • Parameter

    ParameterDescription
    funcnameThe library name of a dynamic module. (Maximum Length : TDL_FUNCNAME_SIZE – 1)
    urcodeUnlike the other tdlcall() functions, a urcode is used only when sending a global sequence number.
    flagsIf set to a TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS will be set.
    rettypeThe return type of a dynamic module function to be called. Available values for this parameter are explained in the table below.
    retvalA pointer to a buffer to store return values of a dynamic module function.
    argcThe number of arguments for a dynamic module function. Currently, the maximum available number of arguments is 10.
    ...Enters parameters to be sent to a dynamic module function as a variable argument. A pointer (void*) type of parameters must be sent.
  • Values for return type

    ParameterDescription
    TDL_VA_CHARThe returned type of a dynamic module function is a char type.
    TDL_VA_SHORTThe returned type of a dynamic module function is a short type.
    TDL_VA_INTThe returned type of a dynamic module function is an integer type.
    TDL_VA_LONGThe returned type of a dynamic module function is a long type.
    TDL_VA_FLOATThe returned type of a dynamic module function is a short type.
    TDL_VA_DOUBLEThe returned type of a dynamic module function is a short type.
    TDL_VA_PVOIDThe returned type of a dynamic module function is a void * type.
    TDL_VA_VOIDThe returned type of a dynamic module function is a void type.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.
  • Example

    • Dynamic module call

      int myfunc(double *a, double *b, double *c) {
          double sum;
          return (int)(((double)(*a) + (double)(*b) + (double)(*c))/3);
      }
      
      char * myfunc2(int *type) {
          char *msg;
          switch (*type) {
              case 1: msg = “foo”; break;
              case 2: msg = “bar”;break;
          }
          return msg;
      }
    • Program to be called

      #include <tdlcall.h>
      int main(int argc, char *argv[]) {
          int n;
          long urcode;
          int retval;
          double a, b, c;
          int type;
          char *retmsg;
      
          urcode = tdlgetseqno();
          a = 2.5;
          b = 3.0;
          c = 3.5;
          if ((n = tdlcallva2(“mylib001”, “myfunc”, urcode, TDLTRAN,
                   TDL_VA_INT, &retval, 3, &a, &b, &c)) != TDL_OK) {
              error processing;
          }
      
          type = 1;
          if ((n = tdlcallva2(“mylib001”, “myfunc2”, urcode, TDLTRAN,
                   TDL_VA_PVOID, &retmsg, 1, &type)) != TDL_OK) {
              error processing;
          }
      }

3.7. tdlcallva2

The tdlcallva2 function calls the latest version of a dynamic module using a library and function name as a key. A parameter is sent as-is for a dynamic function module that has an unfixed prototype. Delivered arguments must all have a <void *> pointer type. In a dynamical module function, all delivered parameters must be created as <void *> pointer types.

Other than the use of a library and function name as a key, this function is identical to a tdlcalva() function. It is available when VERSION=3 is specified in a TDL configuration file (tdl.cfg).

  • Prototype

    #include <tdlcall.h>
    int tdlcallva2(char *libname, char *funcname, long urcode, int flags, int rettype, void *retval, int argc, …);
  • Parameter

    ParameterDescription
    libnameThe library name of a dynamic module. (Maximum Length : TDL_FUNCNAME_SIZE – 1)
    funcnameThe function name of a dynamic module.(Maximum Length : TDL_FUNCNAME_SIZE – 1)
    urcodeUnlike other tdlcall() functions, it is used only when sending a global sequence number. When not using a global sequence number, set this parameter to 0.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS will be set.
    rettypeThe return type of a dynamic module function to be called. Available values for this parameter are explained in the table below.
    retvalA pointer to a buffer to store the return value of a dynamic module function.
    argcThe number of arguments for a dynamic module function. Currently, the maximum available number of arguments is 10.
    ...Enters parameters to be sent to a dynamic module function as a variable argument. A pointer (void*) type of parameters must be sent.
  • Return Type

    ItemDescription
    TDL_VA_CHARThe returned type of a dynamic module function is a char type.
    TDL_VA_SHORTThe returned type of a dynamic module function is a short type.
    TDL_VA_INTThe returned type of a dynamic module function is an int type.
    TDL_VA_LONGThe returned type of a dynamic module function is a long type.
    TDL_VA_FLOATThe returned type of a dynamic module function is a short type.
    TDL_VA_DOUBLEThe returned type of a dynamic module function is a short type.
    TDL_VA_PVOIDThe returned type of a dynamic module function is a void * type.
    TDL_VA_VOIDThe returned type of a dynamic module function is a void type.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

3.8. tdlcreate

The tdlcreate function creates a class instance using a Class Factory in the latest version of a dynamic module. It uses a library name, a namespace, and a class name as keys. It can be used when a VERSION is set to 4 in a tdl.cfg TDL configuration file.

To use a Class Factory in a dynamic module, a user must implement a callback function in a long tdlcreate_cb(char *namespace, char *classname, void *args, void *object) format. A callback function creates an actual class instance using arguments which are passed from a tdlcreate() and sends a reference of an instance to an object.

A user must destroy an instance using a tdldestroy() if the instance is no longer used. Although the version of a dynamic module is changed by using a tdlupdate(), an instance that is created using a tdlcreate() will operate for an old version of a dynamic module before being destroyed using a tdldestroy(). To use an instance for a new dynamic module, call a tdldestroy() and then call a tdlcreate().

To use a Class Factory, the following tdlcreate_cb() callback function needs to be implemented in a dynamic module:

  • Prototype

    #include <tdlcall.h>
    int tdlcreate(char *libname, char *namespace, char *classname, void *args, void *object, long *urcode, int flags)
  • Parameter

    ParameterDescription
    libnameA dynamic module library name. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    namespaceA namespace. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    classnameThe name of a class where an instance is created. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    argsPasses user-defined data to a tdlcreate_cb() callback function.
    objectPointer to a variable for saving the reference of a class instance which is created through a tdlcreate_cb() callback function.
    urcodeA return value of a tdlcreate_cb() callback function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS is set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.
  • Callback Function Prototype

    long tdlcreate_cb(char *namespace, char *classname, void *args, void *object)
  • Parameter

    ParameterDescription
    namespaceA namespace received from a tdlcreate().
    classnameA name of a class where an instance received from a tdlcreate() is created.
    argsUser-defined data.
    objectA pointer to a variable for saving a reference of a class instance that is created through a callback function.

3.9. tdldestroy

The tdldestroy function destroys a class instance using a Class Factory in the latest version of a dynamic module. It uses a library name, a namespace, and a class name as keys. It can be used when a VERSION is set to 4 in a tdl.cfg TDL configuration file.

To use a Class Factory in a dynamic module, a user must implement a callback function in a long tdldestroy_cb(char *namespace, char *classname, void *args, void *object) format. The callback function destroys an actual class instance using arguments which are passed from a tdldestroy().

A user must destroy an instance using a tdldestroy() if the instance is no longer used. Although the version of a dynamic module is changed through a tdlupdate(), an instance which is created using a tdlcreate() operates for the old version of a dynamic module before being destroyed using a tdldestroy(). To use an instance for the new dynamic module, call a tdldestroy() and then call a tdlcreate().

  • Prototype

    #include <tdlcall.h>
    int tdldestroy(char *libname, char *namespcae, char *classname, void *args, void *object, long *urcode, int flags)
  • Parameter

    ParameterDescription
    libnameA dynamic module library name. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    namespaceA nmespace. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    classnameThe name of a class where an instance is created. (Maximum length: TDL_FUNCNAME_SIZE – 1)
    argsPasses user-defined data to a tdlcreate_cb() callback function.
    objectPasses a reference of a class instance to be destroyed by a tdldestroy_cb() callback function. This must be an object that is created using a tdlcreate().
    urcodeA return value of a tdlcreate_cb() callback function.
    flagsIf set to TDLTRAN, a global sequence number must be passed using a urcode. If unspecified, a TDL_NOFLAGS is set.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_OPEN_ERRORAn error was returned with dlopen().
    TDL_SYM_ERRORAn error was returned with dlsym().
    TDL_CLOSE_ERRORAn error was returned with dlclose().
    TDL_SYSTEM_ERRORAn error with another system function calls.
    TDL_INT _ERRORAn error with an internal library.
    TDL_ENOFUNCCannot find a target module or function.
    TDL_ENV_ERRORAn error with an environment variable configuration.
    TDL_VER_ERRORA version mismatch between the versions of a TDL shared memory and a configuration file (tdl.cfg).
    TDL_ARG _ERRORAn error in an argument.
    TDL_ENOLIBCannot find a target library.
    TDL_TRAN_ERRORAn error while checking version consistency.
    TDL_EINACTIVEA module is temporarily inactive.

To use a Class Factory, the following tdldestroy_cb() callback function must be implemented in a dynamic module.

  • Callback Function Prototype

    long tdldestroy_cb(char *namespace, char *classname, void *args, void *object)
  • Parameter

    ParameterDescription
    namespaceA namespace received from a tdldestroy().
    classnameThe name of a class where an instance received from a tdldestroy() will be destroyed.
    argsUser-defined data.
    objectThe reference of a class instance to be destroyed through a callback function.

3.10. tdlerror

The tdlerror function converts a tdlcall function error to a character string. If an error occurred in a previous tdlcall() function call, detailed information will be obtained about the error in a string format. A pointer returned from this function is a pointer to a static variable that may change on a following call to a tdlcall().

To maintain content of this variable, the content should be copied to another variable.

  • Prototype

    #include <tdlcall.h>
    char* tdlerror(int retval)
  • Parameter

    ParameterDescription
    retvalA return value from a previous tdlcall() function call.
  • Return Value

    ValueDescription
    dlopen failReturned when receiving a TDL_OPEN_ERROR as a return value of a tdlcall().
    dlsym failReturned when receiving a TDL_SYM_ERROR as a return value of a tdlcall().
    dlclose failReturned when receiving a TDL_CLOSE_ERROR as a return value of a tdlcall().
    etc system call errorReturned when receiving a TDL_SYSTEM_ERROR as a return value of a tdlcall().
    TDL lib internal errorReturned when receiving a TDL_SYSTEM_ERROR as a return value of a tdlcall().
    funcname not foundReturned when receiving a TDL_ENOFUNC as a return value of a tdlcall().
    environment not foundReturned when receiving a TDL_ENV_ERROR as a return value of a tdlcall().
    shared version mismatchReturned when receiving a TDL_VER_ERROR as a return value of a tdlcall().
    invalid argumentsReturned when receiving a TDL_ARG_ERROR as a return value of a tdlcall().
    library not foundReturned when receiving a TDL_ENOLIB as a return value of a tdlcall().
    transaction errorReturned when receiving a TDL_TRAN_ERROR as a return value of a tdlcall().
    inactive functionReturned when receiving a TDL_EINACTIVE as a return value of a tdlcall().

3.11. tdlgetseqno

The tdlgetseqno function gets a global sequence number and returns it as a return value.

  • Prototype

    #include <tdlcall.h>
    unsigned int tdlgetseqno(void)
  • Return Value

    ValueDescription
    0 or greater valueA function call was successful.
    0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.12. tdlstart

The tdlstart function starts maintaining Explicit Version Consistency.

  • Prototype

    #include <tdlcall.h>
    int tdlstart(void)
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_TRAN _ERRORA tdlstart() was been carried out before calling a tdlstart(). See "3.2. tdlcall" for detailed information.

3.13. tdlend

The tdlend function stops maintaining Explicit Version Consistency.

  • Prototype

    #include <tdlcall.h>
    int tdlend(void)
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_TRAN _ERRORA tdlstart() has been carried out before calling a tdlstart(). See "3.2. tdlcall" for detailed information.

3.14. tdlsuspend

The tdlsuspend function temporarily suspends maintaining explicit version consistency and a SD (suspend descriptor) is returned. There may be a maximum of 8 simultaneous SDs.

  • Prototype

    #include <tdlcall.h>
    int tdlsuspend(void)
  • Return Value

    ValueDescription
    0 or greater valueA function call was successful.
    TDL_TRAN _ERRORNot in Explicit Version Consistency mode. See "3.2. tdlcall" for detailed information.

3.15. tdlresume

The tdlresume function resumes a temporarily suspended Explicit Version Consistency.

  • Prototype

    #include <tdlcall.h>
    int tdlresume(int sd)
  • Prototype

    ParameterDescription
    sdA descriptor from a tdlsuspend().
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_TRAN _ERRORA sd is not a valid value. See "3.2. tdlcall" for detailed information.

3.16. tdlclose

The tdlclose function initializes a reference count of a module to 0 or releases a module from memory.

  • Prototype

    #include <tdlcall.h>
    int tdlclose(char *name, int flags)
  • Parameter

    ParameterDescription
    nameA module name.
    flagsIf set to 0, the reference count of a module is set to 0 and the module will not be released from memory. If set to TDLCLOSE_HARD, the module will be released from memory by a dlclose().
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    TDL_ENOLIBA module does not exist.

3.17. tdlload

When a module is called first through a tdlcall(), a certain period of time is consumed because it needs to search for a hashtable in shared memory as well as load libraries to memory. To prevent a delay, a tdlload function can perform a search for a hashtable and load libraries before calling a tdlcall(). It can also save module information in a local cache.

If VERSION=1 or VERSION=2 is set in TDL configuration file(tdl.cfg), tdlload() will be used. If VERSION=3 is set, tdlload2() will be used and if VERSION=4 is set, tdlload3() will be used.

  • Prototype

    #include <tdlcall.h>
    int tdlload(char *funcname, int flags)
  • Parameter

    ParameterDescription
    funcnameThe name of a function to be loaded.
    flagsNot current supported.
  • Return Value

    ValueDescription
    0A function call was successful.
    TDL_ENOFUNCAn argument is NULL or does not exist in a hashtable.
    TDL_OPEN_ERRORFailed to load a dynamic library in a hashtable to memory.
    TDL_SYSTEM_ERRORFailed to allocate system resources for creating a local cache.

3.18. tdlload2

The tdlload2 function is the same as a tdlload. For more information, refer to "3.17. tdlload".

  • Prototype

    #include <tdlcall.h>
    int tdlload2(char *libname, char *funcname, int flags)
  • Parameter

    ParameterDescription
    libnameThe name of a library to be loaded.
    funcnameThe name of a function to be loaded.
    flagsCurrently not used.
  • Return Value

    Since return values of a tdlload2() are the same as those of a tdlload(), refer to "3.17. tdlload".

3.19. tdlinit

The tdlinit function initially sets shared memory.

  • Prototype

    #include <tdlcall.h>
    int tdlinit(int flags)
  • Parameter

    ParameterDescription
    flagsCurrently not used.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.20. tdldone

The tdldone function initializes shared memory.

  • Prototype

    #include <tdlcall.h>
    int tdldone(int flags)
  • Parameter

    ParameterDescription
    flagsCurrently not used.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.21. tdlfind

The tdlfind function searches for a module index. It is used when a VERSION is set to 1 or 2 in a tdl.cfg TDL configuration file.

  • Prototype

    #include <tdlcall.h>
    int tdlfind(char *funcname, int flags)
  • Parameter

    ParameterDescription
    funcnameThe name of a function to be found.
    flagsCurrently not used.
  • Return Value

    ValueDescription
    0 or greater valueA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.22. tdlfind2

The tdlfind function searches for a module index. It is used when a VERSION is set to 3 in a tdl.cfg TDL configuration file.

  • Prototype

    #include <tdlcall.h>
    int tdlfind2(char *libname, char *funcname, int flags)
  • Parameter

    ParameterDescription
    libnameThe name of a library to be found.
    funcnameThe name of a function to be found.
    flagsCurrently not used.
  • Return Value

    ValueDescription
    0 or greater valueA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.23. tdlstat

The tdlstat function displays TDL statistics. It is used when a VERSION is set to 1 or 2 in a tdl.cfg TDL configuration file. It is required to set a MONITOR to Y in a configuration file.

  • Prototype

    #include <tdlcall.h>
    int tdlstat(char *funcname, struct timeval svc_time, struct timeval cpu_time)
  • Parameter

    ParameterDescription
    funcnameThe name of a function for which statistics are collected.
    svc_timeA variable where service time among statistics is saved.
    cpu_timeA variable where CPU time among statistics is saved.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".

3.24. tdlstat2

The tdlstat2 function displays TDL statistics. It is used when a VERSION is set to 3 in a tdl.cfg TDL configuration file. It is required to set a MONITOR to Y in a configuration file.

  • Prototype

    #include <tdlcall.h>
    int tdlstat2(char *libname, char *funcname, struct timeval svc_time, struct timeval cpu_usrtime, struct timeval cpu_systime)
  • Parameter

    ParameterDescription
    libnameThe name of a library for which statistics are collected.
    funcnameThe name of a function for which statistics are collected.
    svc_timeA variable where service time among statistics is saved.
    cpu_usrtimeA variable where user CPU time among statistics is saved.
    cpu_systimeA variable where system CPU time among statistics is saved.
  • Return Value

    ValueDescription
    TDL_OKA function call was successful.
    Value less than 0A function call failed. Detailed error information can be checked by using a "3.10. tdlerror".