Training
×

15.1. Sharing code – Real-time Shared Library

A Real-time Shared Library (RSL) is like a static library, but code and data from a shared library is added only when the executable file loads. Thus RSLs have an additional function RslMain for process and thread specific initialization and cleaning up during execution. With a shared library, the shared code can be updated without rebuilding the executable file.
 
The function RslMain in the RSL is called whenever a process loads the RSL, a thread is created or deleted, or the process stops using the RSL.
 
To make it easy to start an RSL project, the use of the INtime RSL wizard is recommended.
 
The INtime SDK also installs project “RSL Examples” in the Sample Projects. “RSL Examples” shows how to create functions and global variables in nested shared libraries, how to use them implicitly (called static loading) and how to explicitly load and use them (dynamic loading).
 
Note that up to and including INtime 6, RSL code is not shared in memory between processes.
Making common code available to applications in an RSL – thus avoiding the need to link this code statically and individually to the applications - already is a valuable benefit of an RSL, even if the code is duplicated for each process that uses the RSL.