2

I'm currently making an application in which I have written the underlying model (logic) in unmanaged C++ (it's just in a Visual Studio C++ Console Application Project at the moment) however I want to create the interface in C# as I understand that it is a lot easier for GUI programming due to WPF.

The model of the code is written in C++ as this is the language I am most familiar with and for reasons of efficiency. Porting this to C# is definitely an option, but I am not very familiar with C# (although I have plenty of experience with Java so I'm sure it's not a big leap) so I'd rather keep my logic in C++.

When looking online I found a previous question related to this here:

Fast C++ program, C# GUI, possible?

However this was from 6 years ago now and I was wondering if there are any newer (and easier) ways to link a C++ project to a C# (GUI) project in Visual Studio 2015? I imagine I would still have to create a managed C++ project via CLR->Class Library in VS, but is there any new stuff out there which can make this whole process easier?

I should also note that the GUI will be required to display real-time graphs if this makes any difference to the method used for making the actual GUI (i.e. is this possible in C# via WPF?)

1 Answer 1

3

Definitely managed C++/CLI is not the most beautiful thing ever, but the whole point of its existence is connecting unmanaged code with .NET world, and it does the job well.

When a solution is available in VS out of box, ready and set, I actually see no reason to search for an alternative.

Sign up to request clarification or add additional context in comments.

1 Comment

This. I started writing my own answer but realized it's basically the same as this one.. Not extremely beautiful, but as long as you keep your CLI just a tiny layer to expose the C++ meat to .Net you're golden. It just works. Also have a look at msdn.microsoft.com/en-us/library/bb384865.aspx for converting strings, shared_ptrs etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.