I have Unmanaged C# DLL:
[DllExport(ExportName = "GetStudentsList", CallingConvention = CallingConvention.StdCall)]
static public List<StudentsStruct>GetStudentsList() { return List<StudentsStruct>; }
[DllExport(ExportName = "maxElement", CallingConvention = CallingConvention.StdCall)]
static public int maxElement(int a, int b) { return c; }
I want to return List<StudentsStruct>
from the function.
And I want to run above function in a C++ Application:
using GetStudentsListFn = List<StudentsStruct> (__stdcall *) (void);
GetStudentsListFn GetStudentsList = reinterpret_cast<GetStudentsListFn> (GetProcAddress(mod, "GetStudentsList"));
List<StudentsStruct> myList = GetStudentsList();
using MaxElementFn = int(__stdcall *) (int a, int b);
MaxElementFn maxElement = reinterpret_cast<MaxElementFn> (GetProcAddress(mod, "maxElement"));
std::printf("max: %d\n", maxElement(1, 2));
MaxElement( ) function is working perfectly because it return an int. But i want to return List/Array of "StudentsStruct", from C# to C++.