Real-Time Processes and Dynamic Link Libraries (DLLs)

RTX64 supports the following types of processes and libraries:

Real-time Processes

Real-time processes are executing programs that run within the RTX64 Subsystem. These are typically referred to as RTSS processes. RTSS processes can consist of one or more threads which can be run on any RTSS processor within the process or thread's affinity mask. These processes have a .RTSS extension, and can be written in native C or C++.

Proxy Processes

Proxy processes are executing programs that run within the Real-time Subsystem (RTSS). Proxy processes can consist of one or more threads which are run on the first RTSS process. These processes are internal to the subsystem and represent windows processes and threads that are interacting with real-time threads and objects.

Real-time Dynamic Link Libraries (RTDLLs)

Real-time dynamic link library (RTDLL) is a module that contains functions and data that can be used within an RTSS process or another RTDLL. RTDLLs are loaded within the context of the loading process and can be loaded implicitly or explicitly.

Implicit loading is done by linking in an export library for the RTDLL you wish to use within your RTSS process. This allows the build process of your RTSS process to resolve all external references for functions exported by the RTDLL. On loading of the RTSS process, the loader will trigger the loading of the RTDLL so these exported functions can be used by the RTSS process.

Explicit loading does not require the linking in of an export library. It is done using the standard LoadLibrary, GetProcAddress and FreeLibrary calls.

These dynamic libraries use a .RTDLL extension and can be written in native C or C++.

NOTE: RTDLL binaries are supported only within the RTSS environment. To call them from a Win32 application, you must first use one of the Windows configurations to build your source as a DLL that can be used within a Windows process.

An RTDLL is loaded within the context of the loading process, RTDLLs are not shared between multiple RTSS processes. If two RTSS processes reference the same RTDLL files, each RTSS process will have its own RTDLL image in memory. Therefore, global variables in the RTDLL image will be private to the referencing RTSS process.

NOTE: RTDLLs do not support Shared data section within an RTDLL to be shared among RTSS processes which load in the same RTDLL file.

Similar to a Windows DLL, when an RTDLL is first loaded into an RTSS process, RTX64 loader calls the RTDLL’s DllMain function, passing it a value of DLL_PROCESS_ATTACH for the fdwReason parameter. This happens only when the RTDLL’s file is first loaded into the RTSS process.

When an RTDLL is unloaded from RTSS process, RTX64 loader calls the RTDLL’s DllMain function, passing it a value of DLL_PROCESS_DETACH for the fdwReason parameter. The thread context of executing the DllMain function code depends on the process terminating circumstances.

Unlike Windows, RTSS does not call DLLMain with the parameters DLL_THREAD_ATTACH on thread creation or DLL_THREAD_DETACH when threads are exiting.

NOTE: RTX64 does not support RTDLLs based on ordinal number binding.

DLL_PROCESS_DETACH and Implicit Linking

When you use implicit linking, DLL_PROCESS_DETACH is called within the context of the internal system thread during the process cleanup stage. Implicit DLL detaching occurs at the end of ExitProcess. User code should not perform any API calls during DLL_PROCESS_DETACH.

Debugging must be done using RtPrintf, as calls to printf are not allowed. Breakpoints also are not allowed.

IMPORTANT! Failure to observe these restrictions may cause RTX64 to become unstable.

Controlling RTSS processes and RTDLLs:

See the following topics to learn how to perform the following tasks:

Related topics: