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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:14:22+00:00 2026-05-26T14:14:22+00:00

My question is what’s the best way to create an inteface with C++ code.

  • 0

My question is what’s the best way to create an inteface with C++ code.

Basically so far I have a console project in c++, that works as I expect to, but I now want to make a GUI for it. The choices to me seemed to be:

  1. Make a dll of the c++ project, and then make a C# form which uses the dll to do the logic.

  2. Same as 1 except with VB.

  3. Use QT or something eqvilent and make the inteface in the same project.

I’ve been trying option 1 for quite sometime. I made the library I believe successfully by making a library project in Visual Studio 2005. I then put it in my c# project but I then had a problem of being able to instantuate my class, but the c# project couldn’t see my methods.

The only fix I could find to this was to use the ref keyword. The problem with this was then not being able to mix managed and unmanaged code and trying this on one of the larger classes produced about 250 errors.

Option 2 i had the same problem with.

I’ll start option 3 if I have to, I just wondered if I was missing anything fundamental or any suggestions in general?

Cheers for reading.

  • 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-26T14:14:23+00:00Added an answer on May 26, 2026 at 2:14 pm

    You absolutely can use C++ code from C#, but if it’s unmanaged C++ code, you have to delve into the realm of pinvoke to call your code.

    If you’re attempting to leverage an existing C++ library from .NET, one of the easiest ways to do this is by using C++/CLI as a wrapper around your unmanaged library. C++/CLI compiles into .NET bytecode, but features lots of automatic unmanaged interop. A phrase that’s often floated about when using C++/CLI unmanaged interop is “it just works”. It’s an accurate phrase.

    Once you have a C++/CLI wrapper for your unmanaged code, C# should be able to see everything exposed by your C++/CLI library.

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

Sidebar

Related Questions

Question Is there a way to have a method that will always run anytime
Question for the video tag, the following code works for every browsers expect opera
Question: I have written a console program that uses the SQL server 2005 web
Question is about what is the best way to create vector of vector s.
Question: I have a console program that shouldn't be seen. (It resets IIS and
QUESTION How can I create a MySQL table so, that a field's default value
Question update: I have figured out that importing JQuery (even without using it at
Question: Can anyone please provide a full code example that shows how one does
Question Can I build a image database/library that has an e-commerce style checkout system
Question is quite simple. Let's say I have an URL config with line: url(r'^models/(?P<model_group_id>[0-9]+)/(?P<page>\d+)/$',

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.