Environment variables used by kwinject

kwinject uses a number of environment variables. Some are required to communicate between the interception module and the filter program; others are optional and are provided to ease the integration of Klocwork into your build.

UNIX environment variables

Variable Description
LD_PRELOAD LD_LIBRARY_PATH These system-wide variables are used to set up the interception module. Depending on the path to the installation directory, kwinject sets either LD_PRELOAD, or both LD_PRELOAD and LD_LIBRARY_PATH. If the installation path does not contain whitespace characters, kwinject defines LD_PRELOAD as the full path to the interception library (libkwinject.so). If the installation path contains whitespace characters, LD_PRELOAD cannot be defined in the same way, because it is a space-separated list of libraries. In this case, kwinject defines LD_PRELOAD to a short name of the library, and adds the library path to LD_LIBRARY_PATH.
KW_LD_PRELOAD KW_LD_LIBRARY_PATH These variables have the same value as LD_PRELOAD and LD_LIBRARY_PATH, respectively. The sole purpose of defining these variables is to ease build integration. If your build uses LD_PRELOAD for its own needs, the value of KW_LD_PRELOAD can be checked to reset the value of LD_PRELOAD during the Klocwork-enabled build. These variables do not have any direct impact on kwinject.
KW_INJECT_SOCK name of the local socket file, used to send/receive intercepted commands.
KW_NO_LD_LIBRARY_PATH You can use this variable to make kwinject work with build systems that disallow the use of LD_LIBRARY_PATH. If KW_NO_LD_LIBRARY_PATH is enabled, you need to copy libkwinject.so from Klocwork's lib and lib64 directories to your system /usr/lib directories (both 32 and 64-bit versions). Note that this step needs to be done again after an upgrade, and the actual path to the your lib directory varies by system type. You can set this variable to any non-zero value to enable it, or to '0' to disable it.
KW_NOT_USE_CLANG_OVERRIDES You can use this variable to force the Klocwork parser to behave like the MSVC CL compiler, which disables it from behaving like the Clang compiler. If you are upgrading from a previous release and are seeing an inconsistent issue count, you can enable this option (KW_NOT_USE_CLANG_OVERRIDES=1) and run your analysis as usual to resolve the issue.