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 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here is the solution I came up with: function url_for($urls,$name,$args)… May 17, 2026 at 12:12 am
  • Editorial Team
    Editorial Team added an answer Solved Turns out that I had originally tried to set… May 17, 2026 at 12:12 am
  • Editorial Team
    Editorial Team added an answer The reason it doesn't work that way makes sense when… May 17, 2026 at 12:12 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

I need access to the uint64_t typedef from stdint.h in some wrapper code that
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
This way lies madness, I know. I have an executable (the source code to
I'm writing a mixed C++/CLI DLL with both managed and unmanaged classes. Both need
Is it possible to call the JVM's built-in native code, i.e. the code that
I have an associative array that I might need to access numerically (ie get
In a function, I have several consecutive for loops with the same code but
I'm trying to use code similar to clrdump to create mini dumps in my
I have a native dynamic link library written in VC++6 and I do not

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.