I have a C# function that I made into a DLL:
public static string Test(string name)
{
return "Hello " + name;
}
In C++/CLI project I successfully import that DLL, now I want to have a way to call that function and make it available for normal unmanaged C++. So I want to export the C++/CLI function like this:
extern "C" __declspec(dllexport)
void __stdcall Example(char* name, char* greet) {
// name will be passed to C# Test(...) function
// and greet will contains the returned value
// call to the C# function here:
...
}
I dont care what the C++/CLI function looks like, as long as i can export it to normal unmanaged C++.
** Edit: as someone complain about my question, I only need to know how you can call the C# function, given a C string, and how to retrieve the returned result and store it in another C string. It's not like a "problem", it's like a newbie who don't know how to code, and come here to ask... Thank you **
** Edit2: now i noticed, someone has edited my post (i dont know, a moderator or someone...). Now when i re-read my post, even i don't know what the post trying to ask... Please, i think you shouldn't do that **