C++ Interop

examples of interoperation with C++\CLI and C#

1.0 Concept

Interop is a term used to describe collaboration between two or more components written in different languages. In this repository there are examples of interoperation between code written in C++, C++\CLI, and C#.
One reason for using interop is to take advantage of the very well engineered Windows Presentation Foundation (WPF) framework to build Graphical User Interfaces (GUIs) for C++ code. WPF requires the use of a .Net language, usually C#, but occasionally C++\CLI.

2.0 Contents

This repository provides a collection of interoperation useage demos and examples:
  • CppBridge:
    Demonstrates interop by running a native C++ tokenizer from a C# client, using a C++\CLI shim class to connect the client and tokenizer.
  • FormsInterop:
    Expands on the first demo by using three different GUI implementations, a C++\CLI form, a C# winform, and a C# WPF form.
  • ManagedCPP:
    Provides examples of C++\CLI (managed code) and native C++ interacting in code from a single file. A number of projects are included. The best place to start is with the Managed_Again project.
  • ManagedCppSyntaxExamples:
    A collection of small and simple demonstrations of C++\CLI features.
  • WPF-ConsoleApplication:
    Shows how to provide console output from a WPF application.
  • WPF-Interop:
    This is a prototype for the WPF GUIs you will see packaged with many of the tools in the Tools collection.

3.0 Build

This code has been built with Visual Studio, Community Edition - 2019, and tested on Windows 10.