C++ to C#... RRS feed

  • Question

  • Hi All,
    I wrote a Visual Studio 2010 C++ program and I need to convert it to C# program (I.e. all of the GUI etc. needs to be with C# and the internal program should be/stay on C++)
    What is the best way to do it without ruing it?
    Is the best way is to convert it (i.e. the Visual C++ to dll program) and it would be called by the C# Form application or there is a better way?
    If that's the best way how can I call from a C# program the dll that has been written by the c++?
    And how can I enter it’s (The dll) parameters from the C# Form application? How can I read the Output from the dll to use it for the C# Form application?


    Thursday, July 5, 2012 6:43 AM


  • Hi,

    I would suggest to really research the possibilities before deciding what design is best. There is no "That is the best way" in my eyes. It always depends on what exactly you need to do.

    So possibilities that I see:
    - COM - If you cerate a COM component, this could be easily used through a wide range of technologies.
    - You could use Platform Invoke (P/Invoke) to access Win32 DLLs from .Net
    - You could write a mixed assemblies in C++/Net where all required stuff is available when referencing that DLL from other .Net Projects

    For all you can find a lot of ressources on the net by looking for COM, Platform Invoke or Mixed Assemblies. Some starting points on msdn might be:
    http://msdn.microsoft.com/en-us/library/aa288468.aspx (older vs2003 article but basics are unchanged!)

    With kind regards,


    • Proposed as answer by servy42 Thursday, July 5, 2012 2:15 PM
    • Marked as answer by Lisa ZhuModerator Tuesday, July 10, 2012 10:16 AM
    Thursday, July 5, 2012 8:10 AM