Creating and Modifying a New Visual Studio Project

This section shows you how to create a new project in Visual Studio using the RTX64 Application Template and modify the basic project framework.

Start a new Visual Studio project

  1. Launch a supported version of Visual Studio.
  2. Create a new project: click Create a new project from the Visual Studio Start Page.

Select the Application Template

In the Create a new project dialog, you can select the RTX64 application template for creating an RTX64 application.

  1. Filter all available project templates by C++ Language and RTX64 Platform.
  2. Select the Rtx64 Application template.
  3. Specify the Name and Location for the new project, then click Create. In this example we will be use the name Rtx64App1 and a location of C:\Samples\RTX64.

Configure the RTX64 Application Template

The RTX64 Application template provides basic project settings, as well as compiler and linker options. For more information, see Compiler and Linker Options.

  1. View the Current project settings.
  2. Ensure that the Provide an RTSS application framework option is selected.
  3. Select a provided framework.
  1. Click Finish.

Notes

Upon completion of the RTX64 Application template there are a few things worth noticing:

  1. Your project will have these configurations:

x64

  1. In the generated Header file, you will see RTX64-specific header files:
  1. In the project's C/C++ settings you will see the addition of RTX64-specific paths:

For example, for RTX64 4.5 - version 4.5 of the RTX64 product - the path is %RTX64SDKDIR4%\include

  1. In the project's linker settings, you will see the addition of RTX64-specific paths, preprocessor definitions, and libraries:

%RTX64SDKDIR<MAJORVERSION>%\lib\$(Rtx64Platform) - additional path for the RTX64 libraries

For example, for RTX64 4.5 - version 4.5 of the RTX64 product - the path is %RTX64SDKDIR4%\lib\$(Rtx64Platform)

rtapi.lib – library that provides Windows application with the ability to interact with RTSS processes

%RTX64SDKDIR<MAJORVERSION>%\lib\$(Rtx64Platform) – additional path for the RTX64 libraries

Startup.lib or StartupCRT.lib – libraries used of RTX64 startup functionality

Rtx_rtss.lib – library that provides RTX64 support and functionality

  1. In the project's Build events and Post-build events you will see an event for StampTool. This step is executed to license all binaries created so they can run on a target system with a valid RTSS subsystem.

NOTE: Only RTSS and RTDLL applications need to be stamped by StampTool.

Modify the program

The new project contains a basic program framework consisting of source and header files, as well as additional elements for the framework that was chosen. Once the project has been created, you can modify the program source code.

  1. Open the new program shell by selecting it from the list of Source Files.

  1. For the first modification, increase the timer period from 500 microseconds to 1 second.

  1. Next, set the test duration to 5 seconds and then display a completion message.

  1. Open the Rtx64App1RtTimerThread.cpp file for the RTX64 application and add a line to display status when the TimerHandler is called.

Build and run a RTX64 executable

  1. Set the Solution Configuration so that the program will be built as an RTSSDebug executable.
  1. Select Build Solution from the Build pull-down menu.
  2. If your development system also contains a RTX64 Runtime, you can run the .rtss executable either by double-clicking on the file name in Explorer or by typing it into a command prompt:

  3. rtssrun C:\Samples\RTX64\x64\RTSSRelease\Rtx64App1.rtss

    If your Runtime is located on a different system, you will need to copy the binary to that system first.

related TOPICS: