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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:23:45+00:00 2026-05-29T13:23:45+00:00

**unmanaged class** this is the unmanaged class declaration #ifdef EXPORT_CLASS #define DLL_EXPORT __declspec(dllexport) #else

  • 0
**unmanaged class**

this is the unmanaged class declaration

#ifdef EXPORT_CLASS
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
public class DLL_EXPORT cppclass
{
private:
string x;
public:
cppclass();
~cppclass();
string native();
};


**UNMANAGED CLASS DEFINITION**

this is the unmanaged class definition

 cppclass::cppclass()
{
x="hello";
};
cppclass::~cppclass()
{
};
string cppclass::native()
{
return x;
};

**MANAGED CLASS**

this is the managed class declaration

public __gc class Mclass
{
//private:
public:
cppclass * obj;
public:
Mclass();
~Mclass();
string native();

};

**MANAGED CLASS DEFINITION**

//this is the managed class definition

#include"managed.h"
Mclass::Mclass()
{
    obj=new cppclass();
};
Mclass::~Mclass()
{
    delete obj;
};
string Mclass::native() 
{
return  obj->native();
};

Now all this is made into a dll and imported in a c# project


using managed;

 namespace ConsoleApplication1
 {
 class Program
 {
    static void Main(string[] args)
    {
        managed.Mclass first = new Mclass();
        String x=first.nativ();
        Console.Out.WriteLine(x);
    }

}

}

error comes that Managed.Mclass.nativ() is not supported by the language

  • 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-29T13:23:46+00:00Added an answer on May 29, 2026 at 1:23 pm

    You are returning a native string from your C++/CLI wrapper class. You need to return a managed .net string instead. The wrapper class must translate parameters and return values of native classes to appropriate managed classes.

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

Sidebar

Related Questions

I have a managed class which contains unmanaged class pointer: class Managed { public
If I define a new ref class in C++/CLI, can I then use this
I am writing an excel class and i want to release this unmanaged object
I have an unmanaged class that I'm trying to dllexport from a managed DLL
I have implemented a Splash Screen according to WiredPrairie unmanaged c++ splasher class. But
I have an unmanaged dll with a class MyClass in it. Now is there
The unmanaged function(pure c++, if that matters): void fooC(float& result); I define the wrapper
I observe unmanaged.dll files having a unmanaged.dll.manifest file tagging along. On opening this files
I have a class which uses a method in user32.dll: [System.Runtime.InteropServices.DllImport(user32.dll)] private static extern
I'm writing an (unmanaged) C++ class to wrap the Windows PropertySheet . Essentially, something

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.