Provision of a TwinCAT C++ driver and its classes

The TwinCAT C++ driver must be available on the target system. TwinCAT offers a deployment for this purpose, so that the components only have to be stored properly on the development computer.

The existing TwinCAT C++ driver as well as its TMC description file(s) are available as a driver archive. This archive (IncrementerCpp.zip) is unpacked in the following folder:
C:\TwinCAT\3.1\CustomConfig\Modules\IncrementerCpp\

The TwinCAT Deployment copies the file(s) later in the following folder upon the activation of a configuration in the target system:
C:\TwinCAT\3.1\Driver\AutoInstall\

1. Open a TwinCAT project or create a new project.
2. Select the required C++ driver in the solution under the TcCOM Objects node in the Class Factories tab.
This ensures that the driver is loaded on the target system when TwinCAT starts up. In addition this selection provides for the described deployment.
Provision of a TwinCAT C++ driver and its classes 1:
Provision of a TwinCAT C++ driver and its classes 2:

Creation of the C++ driver

In the documentation for TwinCAT C++ there is a detailed explanation on how C++ drivers for TwinCAT are created.
For Sample03 it is important to note that TwinCAT C++ drivers whose classes are supposed to be dynamically instantiated must be defined as “TwinCAT Module Class for RT Context”. The C++ Wizard offers a special template for this purpose.
In addition this sample uses a TwinCAT C++ class which manages without TcCOM initialization data and without TcCOM parameters.