RTDLL Sample

This example program demonstrates how to use an RTDLL in an RTSS Process. It uses library functionality to provide an application similar to the DLL sample.

This sample includes three components:

Source Files

The Rtdll example includes three projects, available from the VS<Visual Studio Version> folder:

File Description
SampleRtDll_<Visual Studio version>.vcxproj Builds SampleRtdll.Rtdll. This is an RTDLL that contains the function Toggle which toggles the state of the speaker.

ExplicitLoadRtdll_<Visual Studio version>.vcproj

Builds ExplicitLoadRtdll.c. This loads an RTDLL, calls an RTDLL function, and then frees the RTDLL. It can be built as either a Win32 .EXE binary, or an .RTSS binary.

ImplicitLoadRtdll_<Visual Studio version>.vcproj

Builds ImplicitLinkdll.c. This is compiled with the project settings the .rtdll is linked in. Through an import command, we define the toggle function and run the toggle through the RTSS we just called.

The Source folder contains three source files:

File Description
explicitlyUsingRtdll.c Source file that loads an RTDLL, calls an RTDLL function, and then frees the RTDLL. It can be built as either a Win32 .exe binary, or an .rtss binary.
implicitlyUsingRtdll.c Source file that is compiled with the project settings the .rtdll is linked in, then through an import command we define the toggle function and run the toggle through the RTSS we just called.
sampleRtdll.c Source file for an RTDLL that contains the function "Toggle" which toggles the state of the speaker.

Building the Sample

Build the three samples using any of the four available configurations: Debug, Release, RTSSDebug, or RTSSRelease.

Running the Sample

Run the explicit loader binary:

RTSSrun explicitLoadRTDLL.rtss

Alternatively, you can run the implicit loader binary:

RTSSrun ImplicitLinkRTDLL.rtss

The shared library function Toggle is called repeatedly through a periodic RTAPI timer for 10 seconds in both versions.

Expected Results

Unexpected Results

The sample fails to find or load the required RTDLL library (it must be in the same directory as the executable).

Remarks

APIs Referenced

RTAPI

Windows Supported