I'm trying to export some void/functions from a C++ Cli that wraps C# .Net Functions.
In this moment I can properly export methods that return integer value, but when I try to export a Void, I get the error:
Error C3395 'Test2': __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention ClassLibrary1
This is the full code:
#pragma once
using namespace System;
using namespace System::Reflection;
using namespace RobinHoodLibrary;
namespace ClassLibrary1 {
public ref class Class1
{
// TODO: Add your methods for this class here.
RobinHood^ robin = gcnew RobinHood();
public: int Add(int Number1, int Number2)
{
return robin->Add(Number1, Number2);
}
public: System::Void Test()
{
robin->Test();
}
public: int Test1(int i)
{
return robin->Test1(i);
}
public: System::Void Test2(String^ txt)
{
robin->Test2(txt);
}
};
}
extern __declspec(dllexport) int Add(int Number1, int Number2) {
ClassLibrary1::Class1 c;
return c.Add(Number1, Number2);
}
extern __declspec(dllexport) void Test() {
ClassLibrary1::Class1 c;
c.Test();
return;
}
extern __declspec(dllexport) int Test1(int i) {
ClassLibrary1::Class1 c;
return c.Test1(i);
}
extern __declspec(dllexport) System::Void Test2(String^ txt) {
ClassLibrary1::Class1 c;
c.Test2(txt);
}
I can easy export Add, Test and Test1 method but not Test2.
How can I to fix it ?
Thanks to support