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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:25:51+00:00 2026-06-02T11:25:51+00:00

I have implemented a library known as GDAL in C++/MFC, this project also implement

  • 0

I have implemented a library known as GDAL in C++/MFC, this project also implement gdiplus for drawing bit map.

So in short: i incapsulated everything in a class that takes some int, string and other pretty common types and returns some of those type plus some gdiplus::Bitmap. All of this nicely packed in a .dll and .lib.

So now i would like to use this library in a C# project to use all the power of the forms.

I searched across the whole interweb for an answer but couldn’t find anything very specific with tutorials and other helpfull documention.

But there was one solution that caught my eyes but wasn’t very well described, it was the c++/clr wrapper. I created one that C# finnely accepted as a reference, but it does not let me instanciate that class nor see the namespace or anything related trough intellisence.

If someone could help me down that road or give me a similar good one that would be much appreciated.

  • 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-06-02T11:25:53+00:00Added an answer on June 2, 2026 at 11:25 am

    You can’t use C++ classes in a C# project.

    You have two options.

    The first approach would be to create a managed wrapper in VC++, which would
    create a managed class which accesses the unmanaged class and aggregates the
    calls to the various properties/methods on the class.

    See this article for how to do this

    Once you have the wrapper, you can just set a reference, and then use
    your class from C#.

    The second approach is to wrap the MFC object in a COM object.
    You would have to define your interface, then create the class factory, then instantiate the object… It is more “object oriented”, but it is a lot of work, see the tutorial

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

Sidebar

Related Questions

I have a WCF Service Library (implemented using NH) with one of the class
I have to implement a IExceptionHandler for the Enteprise Library 4.1. In my particular
I have a data access library that has a few classes that all implement
I have implemented Change Tracking (http://msdn.microsoft.com/en-us/library/cc280462.aspx) on some tables I am using Linq2Sql on.
I have a custom project type based on the C# Class Library project type
For a simple Java library which performs operations in constant intervals I have implemented
I am creating one class library project. Now by default I have one App.Config
If I have implemented a Java Library (that offers certain functionality), could I transform
My scenario is this: I have a custom RavenDB membership provider that is implemented
i know qsort from c library and i have implemented it with chars and

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.