简体   繁体   中英

Cross-platform C++ application with .NET GUI?

I have a few years of experience in cross-platform desktop development (Windows and MacOSX, not Linux (at least not for GUI apps)). Usually I create the GUI on MacOSX with Cocoa, and on Windows I use the old-fashioned Windows API. I have not used Qt because when I started it was still under the GPL license.

I find the native experience very important so I'll keep using Cocoa for Mac. However for Windows I am considering using the .NET framework for the GUI code. I have no experience integrating .NET code with an existing cross-platform C++ code base and it seems that I can go with C++/CLI or C#.

Has anyone done such an approach before? Did it work out well? Do you need to bundle the .NET framework with the installer? Does the added .NET code add a lot of weight to the final executable?

You can use Mono , it's very nice and cross-platform.

On Windows I suggest you to use Visual Studio , also check the Express edition of it(it's not cross-platform).

Has anyone done such an approach before?

Yes

Did it work out well?

Of course!

Do you need to bundle the .NET framework with the installer?

No

Does the added .NET code add a lot of weight to the final executable?

Depends

Not .Net: Also check Qt and GTK+ ;)

I considered this but gave up cause the .NET framework is growing faster then you can blink your eyes. NET 3.5 is a hundert MB download and yes your users need it.

I'm currently working on a GTK/Delphi/Cocoa Cross Platform Library for my application. I compile Delphi into a DLL and use this from a common C/C++ code base because i found Delphis VCL much better and easier to use.

And i agree that - at least for ISV's - the integration and quality of the GUI becomes more and more important because this is an important difference from the free open source software market.

Yes, you need to bundle the .NET framework with the installer or notify the user that they need to install it and provide a link if it's not already installed. In my experience, the added .NET code does add some appreciable weight to the executable, but I've found it to be more inconvenient having to install the .NET framework on machines that did not have it - the installation does take some considerable amount of time.

What is the relevance of Qt being licensed under the GPL? Keep in mind that this does not mean your code must be licensed under the GPL; we develop a number of proprietary applications using Qt. However, if you modify Qt and release an application using those modifications, the modifications (but not any of the rest of your code) would have to be released. We've had good success with building cross-platform Qt applications, modulo some teething problems, primarily with multithreading.

As far as .NET, C++/CLI would probably be the least painful way to integrate with an existing C++ codebase. The .NET framework would have to be installed to run the application, but it does not necessarily have to be bundled with the installer, so that people who already have .NET don't have to download it again. It will certainly add some weight to the executable but the average desktop PC will not notice it; the design of your software and choice of algorithms will have a much bigger effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM