Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620056
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:30:30+00:00 2026-05-22T02:30:30+00:00

We have legacy C++ code performing high-performance data processing (e.g., large volumes of data

  • 0

We have legacy C++ code performing high-performance data processing (e.g., large volumes of data fed from hardware devices that is processed in a time-sensitive manner for display, transforms, and transfer to secondary storage).

We are interested in C#/.NET for new GUIs and new utilities (existing GUIs are C++ MFC and Qt). Of course, with the existing system we have no “language translation” issue to the .NET virtual machine (existing code is all C++).

After much study, and many books, I’m not sure this can be done effectively. Possible approaches (am I missing any?):

  1. Rewrite everything in .NET (can’t
    happen — too much code, bare-metal device access, time-sensitive heavy algorithm processing)
  2. Thin adapter layer for Managed
    C++/CLI
  3. Thick adapter layer for Managed
    C++/CLI
  4. Don’t use .NET (managers feel great
    sadness)

Our concerns about (2) “thin adapter layer” is that it would be nice if the GUIs could (re-)use the logic in the “business” layer (many properties are algorithmically derived), so if we don’t expose/wrap the C++ classes, much GUI logic will merely replicate the existing C++ logic in the business layer.

Our concerns about (3) “thick adapter layer” is that it seems very tedious (expensive) to wrap each C++ class with a C# class, and several books suggest the boxing/unboxing access across that boundary appear to suggest this approach is quite unworkable/prohibitive (it’s performance prohibitive beyond trivial designs).

How would you interface new C#/.NET (GUI) on top of a deep-rich-class-structure implemented in C++?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:30:31+00:00Added an answer on May 22, 2026 at 2:30 am

    C++/CLI is perfect for this. There are no performance issues with the managed/unmanaged translation, since C++/CLI uses the same optimized call technique used by the .NET runtime engine itself to implement high-performance methods such as string concatenation.

    The performance problems arise when you’re copying data back and forth between .NET and native versions of the same data structure, but you’d have the same problem with e.g. using a library that uses BSTR alongside one that uses std::string, and the slow operations are equally obvious (unlike with P/Invoke, which tries to make these translations transparent, and ends up hiding the performance problems in the process).

    There are also some tricks you can use to overcome this. For example, instead of copying a std::vector into a System::Collections::Generic::List, implement an IEnumerator that directly reads from the std::vector.

    And of course, if the data is simply going to be passed directly back to another C++ function, there’s no reason to convert it to a managed type at all. Again, C++/CLI makes preserving the format easy, where P/Invoke tries to convert everything behind your back.

    In summary, the “thin” C++/CLI wrapper layer is the best of your options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some legacy code that compiles with both -02 and -03 set. From
I have some legacy python code that using pypar and mpich2 to transmit data
I have a large chunk of legacy php code that I need to interface
We have some legacy code that needs to identify in the Page_Load which event
I have this legacy code that I am working with and there is code
I have some really complicated legacy code I've been working on that crashes when
I have a whole heap of legacy code that I checked into my SVN
I have a directory full of legacy code from a VB6 application. I have
I have been working on some legacy C++ code that uses variable length structures
I have legacy code which I need to improve for performance reasons. My application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.