C# for UI, c++ for library
I have a numerical libr开发者_JS百科ary coded in C++.
I am going to make a UI for the library. I know some MFC. So one solution is to use MFC and make a native application.
The alternative is C#. I know nothing about C#. But I think it should be easy to learn.
Some tutorial for mixed programming of C++ and C# would be very helpful to me.
Thanks!
Yin
I would recommend using Windows Forms or WPF via C# for your GUI.
Take your numerical library, and use C++/CLI to make a .NET wrapper for it. This makes it trivial to use from C# (it looks like any other C# library).
I highly recommend Nishant Sivakumar's C++/CLI articles on CodeProject for learning about C++/CLI and how to wrap C++ libraries. They're fairly well written.
MSDN is a good reference for how to use Windows Forms from C#.
Write your GUI in C# using WinForms or WPF, and call your native code through Platform Invoke.
Instead of P/Invoke, you might want to consider C++/CLI to make a .NET wrapper for your native library.
IMHO using C# is MUCH more easier than MFC, so you are on the right track.
You can use C# very easily to make the UI. You'll need to write a simple wrapper class to call your unmanaged dll, but that is straightforward. check out the msdn page on that subject
Go with C#. MFC is somewhat dated, so if you need to learn something - go for newer technology, do not waste your time with MFC. I'd go for WPF, learning curve is rather steep, but its fun.
I'd suggest looking into SWIG. You can write the core part of your code in C++ as a dll, then have a C# UI link against it.
If you have the source to your C++ numerical library, you can modify it to compile as C++/CLI then you can link to it just like any other .NET library. It shouldn't require a large amount of work to modify the source with #defines for C++/CLI conditional compiling.
精彩评论