Prerequisites for using dynamic libraries
To use dynamic libraries in a KasperskyOS-based solution, the following conditions must be met:
- Processes that use dynamic libraries must have access to the file systems in which the files of the dynamic libraries are stored. Access to file systems is provided by VFS, which is a separate process. The dynamic libraries must not be used by VFS or other software that is used by VFS to work with storage (such as a storage driver).
- The system program
BlobContainer
must be included in the solution. - Executable files that use dynamic libraries must be built with the
-rdynamic
flag (with dynamic linking).The
CMake
initialize_platform()
command causes this flag to be used automatically for building all executable files defined viaCMake
add_executable()
commands.
If the CMake
command initialize_platform(FORCE_STATIC)
is specified in the CMakeLists.txt
root file, the toolchain performs static linking of executable files.
The CMake
project_static_executable_header_default()
command affects the build of executable files defined via subsequent CMake
add_executable()
commands in one CMakeLists.txt
file. The toolchain performs static linking of these executable files.
The CMake
platform_target_force_static()
command affects the build of one executable file defined via the CMake
add_executable()
command. The toolchain performs static linking of this executable file.
The executable file that is built with the -rdynamic
flag is linked to a static library if a dynamic library is not found. For example, if the CMake
target_link_libraries
(client -lm)
command is being used, the executable file of the client
program is linked to the static library libm.a
if the dynamic library libm.so
is not found.