Paul Krill
Editor at Large

Qt moves forward on toolkit for .NET-C++ interoperability

news
Sep 4, 20242 mins

A work in progress, the Qt/.NET toolkit implements C# interfaces in C++ and offers event notification and object-lifecycle management. implements C# interfaces in C++ and offers event notification and object-lifecycle management.

Credit: Shutterstock/NicoElNino

Qt Group is moving forward with Qt/.NET, a proposed toolkit for interoperability between C++ and Microsoft’s .NET software development platform.

The toolkit includes a Qt-based custom native host for managing assemblies, along with a native-to-managed adapter module providing interoperability services such as instance method invocation, event notification, and object-lifecycle management, according to an August 30 blog post. Qt/.NET’s proposed plan for Qt and .NET interoperability includes implementing C# interfaces in C++ and defining .NET types that extend Qt classes.  

The toolkit enables native object encapsulation. By extending the QDotNETInterface, C++ objects can become accessible to .NET as implementations of C# interfaces, QT said. The Qt/.NET adapter achieves this by offering a managed object to serve as a proxy of the native implementation. This proxy is created by the QDotNETInterface constructor and contains a list of callbacks provided as interface member implementations. From a managed code perspective, the proxy implements the interface and members that are invoked by other .NET objects. Also, Qt classes can be extended in .NET.

Ongoing work in the Qt/.NET project includes the development of code generation for boilerplate native code. In a June 2023 blog post, Qt demonstrated how Qt/.NET can create QObject-based wrapper classes for managed types, including the possibility of accessing properties of .NET as QObject properties and converting .NET events to QObject signals.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author