To use dynamic libraries in a KasperskyOS-based solution, the following conditions must be met:
BlobContainer
must be included in the solution.-rdynamic
flag (with dynamic linking).The CMake
initialize_platform()
command causes this flag to be used automatically for building all executable files defined via CMake
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.