RTDLL

Note: An implicitly linked RTDLL needs to reside in the same directory as the RTSS application that is using it.

Real-time dynamic libraries (RTDLLs) contain modules, functions and data that can be loaded – either implicitly or explicitly – into an RTSS 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.

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. If DllMain’s return value is FALSE, CreateProcess will error out for implicit load-time linking RTDLL, or LoadLibrary will error out for explicitly loading RTDLL. For implicit load-time linking RTDLL, the RTSS process’s primary thread will call the RTDLL’s DllMain function with a value of DLL_PROCESS_ATTACH. For explicitly loading RTDLL, the LoadLibrary calling thread will call the RTDLL’s DllMain function with a value of DLL_PROCESS_ATTACH.

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. If the RTDLL is being unload because a thread in the process called FreeLibrary, the DllMain function code is executed by the thread that called FreeLibrary.

More information