I can return a number e.g. double from the C++ method written in the C++ DLL into C#
C++ side
__declspec(dllexport) double GetData()
{
double data = 5;
return data;
}
C# side
[DllImport("data_acquisition_sys.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern double GetData();
double data = GetData();
But if I want to return an array of doubles double* or double[] like above, just change the return value
__declspec(dllexport) double* GetData() //C++
public static extern double[] GetData(); //C#
I get the following error
Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'return value': Invalid managed/unmanaged type combination.