I'm trying to get method of class from a loaded C# dl-library in C++
Main program (C++):
HINSTANCE hMyDLL = LoadLibrary(L"ClassLibrary1.dll");
if (NULL == hMyDLL) {
std::cout << "LoadLibrary failed\n";
getchar();
return -1;
}
typedef int (WINAPI * function) ();
function f = (function)GetProcAddress(hMyDLL, "Class1.test");
if (NULL == f) {
std::cout << ":(\n";
}
DLL code (C#):
namespace ClassLibrary1 {
public class Class1 {
public static int test() {
return 5;
}
}
}
How can i get method test of class Class1?