Instantiating a TwinCAT++ class as a TwinCAT TcCOM Object

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. Add an instance of Class CIncrementModule in the solution under the node TcCOM Objects.
Instantiating a TwinCAT++ class as a TwinCAT TcCOM Object 1:
Instantiating a TwinCAT++ class as a TwinCAT TcCOM Object 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.
To create the above-mentioned driver archive, Publish TwinCAT Modules is selected from the C++ project context as the last step in the creation of a driver.