none
I want to use C# to define the user interface of a desktop app while the real work is delegated to a native C++ DLL. is this possible? RRS feed

  • Question

  • Hi,

    I want to use C# to define the user interface of a desktop application while all the real work is delegated to a native C++ DLL. Is this possible?

    Regards,

    Juan Dent


    Juan Dent

    Saturday, August 19, 2017 9:17 PM

All replies

  • Yes, this quite possible. You can do it with WinForms and WPF/UWP. Personally I am a fan of WPF, but eitehr works.

    The need to use a native DLL for the real work means a serious number of limitations, however. It requires Unsafe code, wich effectively negates 95% of all the advantages of the .NET Framework. It also negates any Deployment aside from pure old Desktop Programm.
    There are ways around that. But it might be better to just write a native application to begin with.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.


    Sunday, August 20, 2017 12:31 AM
  • Hi Juan,

    Yes, You can do this. As Christopher84's suggestion, you can use Winform or WPF to define the user interface. About delegating to native C++ DLL, You'll need to declare a delegate on the C# side whose signature is compatible with the function pointer declaration on the C++ side.

    I find one thread about implementing callback interface from unmanaged DLL to .net app, please refer to :

    https://stackoverflow.com/questions/2167895/howto-implement-callback-interface-from-unmanaged-dll-to-net-app

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 22, 2017 6:17 AM