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

  • SEARCH
  • Home
  • 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 731835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:04:23+00:00 2026-05-14T07:04:23+00:00

I need to access code in a native C++ DLL in some C# code

  • 0

I need to access code in a native C++ DLL in some C# code but am having issues figuring out the marshaling. I’ve done this before with code that was straight C, but seem to have found that it’s not directly possible with C++ classes. Made even more complicated by the fact that many of the classes contain virtual or inline functions. I even tried passing the headers through the PInvoke Interop Assistant, but it would choke on just about everything and not really no what to do… I’m guessing because it’s not really supported.

So how, if at all possible, can you use a native C++ class DLL from .NET code.
If I have to use some intermediary (CLR C++?) that’s fine.

  • 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-14T07:04:24+00:00Added an answer on May 14, 2026 at 7:04 am

    There is really no easy way to do this in C# – I’d recommend making a simple wrapper layer in C++/CLI that exposes the C++ classes as .NET classes.

    It is possible to use P/Invoke and lots of cleverness to call C++ virtual methods, but I wouldn’t go this route unless you really had no other choice.

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To change the database from being unprotected to protected, you… May 17, 2026 at 8:19 am
  • Editorial Team
    Editorial Team added an answer This is handled in the PropertyDescriptor. You override ResetValue and… May 17, 2026 at 8:19 am
  • Editorial Team
    Editorial Team added an answer You should put custom routes above the default route, when… May 17, 2026 at 8:19 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

To implement data access code in our application we need some framework to wrap
I need to access a mysql database from c# code but I would prefer
I need access to the uint64_t typedef from stdint.h in some wrapper code that
I basically need to know how to import SQL code into Access. I've tried
I need to access some members marked internal that are declared in a third
As part of my project I need to use some Unamanged code dlls in
I have some code (which I cannot change) that I need to get working
I can't create a NT account for everyone that need access to the reports.
I need to access the OpenGL state variables (such as the MVP matrices) in
I need to access RMI methods from a client front end. For different reasons,

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.