shared_libs example
This example demonstrates use of static and dynamic libraries in KasperskyOS.
In the example, the Client program performs the following actions:
- Calls a function from the
hello_sstatic library. - Calls a function from the
hello_d1dynamic library that is linked together with the program and loaded into memory when the process is started. - Calls a function from the
hello_d2dynamic library that is loaded into memory when calling thedlopen()function of the POSIX interface.
To ensure that dynamic libraries can be shared among different processes, the system program named BlobContainer is included in the example.
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
Example files
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<version>/examples/shared_libs
Building and running example
See Building and running examples section.
To ensure that the shared_libs example will correctly run in Raspberry Pi, you must do the following after building the example and preparing your bootable SD card:
- Create the
/libdirectory on the bootable SD card if this directory doesn't already exist. - Open the
build/hdd/libdirectory that was generated when building the example and copy the directory contents to the/libdirectory on the bootable SD card.