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 6653625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:17:34+00:00 2026-05-26T01:17:34+00:00

I have a C++ as the backend and C# as the front end, I

  • 0

I have a C++ as the backend and C# as the front end, I use pinvoke interop mechanism to communicate between the native and managed code.

The issue now is that there are really two parts of computation done by the C++ backend, the initialization part and the compute-on-the-fly part. The initialization needs to be done only once, but it takes a long time to do, whereas the compute-on-the-fly part takes a very short time to do, but it needs to be done over and over again.

And the C++ code as to be kept as it is and can’t be rewritten into C# code.

I can modify both the C++ and C# code as I have them at my disposal.

I know how to do static interop, but I don’t know how to do this kind of state-full interop. Any idea?

  • 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-26T01:17:34+00:00Added an answer on May 26, 2026 at 1:17 am

    You could write a wrapper around your C++ class(es) in C++/CLI thus providing true CLR types. You can than manage their lifecycle in C# seamlessly.

    • There is quite some information on the web for it: here or
      here (just google “C++/CLI wrapper”).
    • And, naturally, on stackoverflow: here.

    Unless there is some nifty tool, you would have to write this wrapper yourself.

    Alternatively, you could write a wrapper function (or a set thereof) around your C++ classes, possibly only exposing the minimum required functionality as “C” functions. You would then passe out a “HANDLE” (Int32, IntPtr, whatever) out of the init-function and requiring it as input for the compute-function. You would have to manage those internally in the wrapper functions (you might also want to provide a cleanup-function).

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

Sidebar

Related Questions

I have my front end script which has the following jQuery code: $.get(/backend/post.php, {
I have a Django web front-end that consumes data from a REST API backend.
I have to use flex 4 for the front end and php with Symfony
I have two files in use. The first is a front end select box
I am looking to use wordpress editor via the front end. i have looked
Back-end: I have a model (User) that has_many of another model (ContactPreference). Front-end: An
I have created an MS Access 2003 application, set up as a split front-end/back-end
I use subversion to manage my yii website (php framework) and have separate backend
I have an application having front end in ASP.NET (VB.NET) and at back end
I've been working through an ordered ManyToManyField widget, and have the front-end aspect of

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.