Product Documentation


Previous Topic

Next Topic

Keep a CTUSER Library Open

CT_USER can execute whatever user code is placed into it. Often an input parameter is used as a command string indicating what action to take. To allow the library to remain open for performance reasons, simply add the following two command string options:

  1. ctuserload: When CT_USER is called with this option, call dlopen() on your shared library. Save the handle (probably a global variable) such that you can unload the library later.
  2. ctuserunload: when CT_USER is called with this option, call dlclose() on your shared library (using the handle you saved when the ctuserload option was specified).

This has the effect of keeping the CT_USER shared library loaded because the system maintains a reference count and so the dlclose() call only unloads a shared library when the number of closes matches the number of opens.