I have a unmanaged (i.e. not ref class)class in c++/CLI implementing an interface in c++/CLI. Both are in the same file Wrapper.h I want to export only the interface and access the method implementation (of the derived class ) in the native c++. I looked for this situation in two books Foundations of C++/CLI by Gordon Hogenson and C++/CLI in ACtion By Nishant Shivakumar Sir. Any workaround for this?
EDIT Below is my Interface in c++/CLI (Wrapper.h). The CSharp (c#)project contains the managed interface ICalculateArea and the class Circle implementing it. FYI...the C# project is being built successfully
#ifdef MANAGED_EXPORT
using namespace System;
using namespace CSharp;
#endif
#ifdef MANAGED_EXPORT
#define DLLAPI __declspec(dllexport)
#else
#define DLLAPI __declspec(dllimport)
#pragma comment(lib,"PATH.lib")
#endif
interface class IWrapper
{
double CalculateArea(double value);
};
and a ref class implementing this interface is as follows::(Wrapper.cpp)
#include"Wrapper.h"
using namespace CSharp;
ref class UnmanagedCircle:IUnmanagedCalculateArea
{
public:
virtual double CalculateAreaWrapper()
{
ICalculateArea^ getArea=dynamic_cast<ICalculateArea^>(gcnew Circle) ;
return getArea->CalculateArea();
}
virtual double GetRadiusWrapper()
{
Circle^ circle=gcnew Circle();
return circle->Radius;
}
virtual void SetRadiusWrapper(double value )
{
Circle^ circle=gcnew Circle();
circle->Radius=value;
}
};
Now I want to access the CalculateArea method in a different native c++ project?