C++ SimConnect Projects


Overview

SimConnect Projects

To build SimConnect add-ons, you must use Visual Studio 2019 or later. To build the project make sure you have completed the following steps.

Potential issues when using SimConnect.lib

C++ projects that import SimConnect.lib will need to also import the following libraries:

Steps to add:

C/C++ Projects

  1. For C or C++ add-ons, start a new Win32 Console Application project if the add-on will have no user interface. Start a new Win32 Project or MFC Application if the add-on will have a user interface.
  2. Ensure the Platform Toolset (Configuration Properties, General) is set to Visual Studio 2019 (v142).
  3. Include the SimConnect.h header file.
  4. Link to the SimConnect.lib library, by adding SimConnect.lib to the Additional Options of the Command Line (see image below). If SimConnect.lib is not local to your project, ensure its folder path is included in Additional Library Directories (Configuration Properties, Linker, General).

    Adding SimConnect.lib to the Additional Options

  5. Build the application using the function calls described in this document.

DLL Projects

  1. Create and add a definition file to the project. This is needed because SimConnect expects the exported names DLLStart and DLLStop to be undecorated (by default additional characters are added to these names). The definition file can be created by selecting Project/Add New Item from the main menu in Visual Studio. Edit the definition (.def) file so it looks like this (where DLL Project is the name of your project):
    LIBRARY "DLL Project"
    EXPORTS
    DLLStart
    DLLStop
  2. Confirm that the definition file has been added to the project by checking the Linker\Input properties:


    Linker Input dialog page

  3. Pay particular attention to the remarks and working samples for SimConnect_CallDispatch.

All Projects

  1. Ensure that the Solution Platforms, in Visual Studio 2019 or later, have been set to 64-bit. While SimConnect interfaces are backwards compatible with legacy 32-bit SimConnects, all new development should be done as a x64 solution.
  2. Ensure the SimConnect.ini file is placed in your %USERPROFILE%\Documents\Prepar3D v5 Files folder. A default version of this files can be found in the SDK\config\SimConnect directory.You do not usually have to make any changes to this file. The SimConnect.ini file provided ensures that the SimConnect debug window opens to display communication information between the server and the clients.
  3. If the client is to work remotely, write a SimConnect.cfg file for it.
  4. By default, SimConnect is disabled. To enable it, you must copy the necessary configuration files to the correct locations. Default versions of these files can be found in the SDK\config\SimConnect directory. Ensure the EXE.xml, DLL.xml files and SimConnect.xml files are placed in either the %APPDATA%\Lockheed Martin\Prepar3D v5 or %PROGRAMDATA%\Lockheed Martin\Prepar3D v5 folder, and edit these files according to the instructions that follow.
  5. Run Prepar3D to test your SimConnect client.

Using Legacy SimConnect Versions

Prepar3D

FSX and ESP

Some third party add-on software requires an older version of SimConnect that was built with either FSX or ESP. When installing Prepar3D through the Prepar3D Bundle, the older SimConnect redistributables are installed automatically. To manually install or reinstall the destributables, go to the redist\Interface folder of the installed product. There are multiple different legacy versions of SimConnect available:


Each of the legacy versions of SimConnect can be installed by following the instructions in their root folders. For most, you can install them using their respective .msi files.


After installing legacy SimConnect client libraries, they will be located in the WinSxS (side-by-side) folder. This means that software add-on components written for older versions of SimConnect will still run as newer versions are released.