I have a C# DLL with the following code:
namespace Csharplib`{
public class Calculate
{
public static int Sum(String value1, String value2)
{
int res = int.Parse(value1) + int.Parse(value2);
return res;
}
}
}`
I have a CLI/CLR C++ Application where I have added the reference of my C# DLL. Following is the code of my CLI/CLR C++ Application:
using namespace System;
using namespace System::Reflection;
namespace CplusManaged {
public ref class DoWork
{
public:int DoSum(System::String ^value1, System::String ^value2)
{
return Csharplib::Calculate::Sum(value1, value2);
}
};
}
__declspec(dllexport) int ShowSUM(System::String ^value1, System::String ^value2)`{
CplusManaged::DoWork work;
return work.DoSum(value1,value2);
}`
When I build my application, I get the following error:
'ShowSUM': __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention
I am a C# developer and I have no experience in C++ whatsoever. Is there any way I can solve this problem?