i have imported a c++ native dll method in c#. below is how the c++ method look
extern "C" declspec(dllexport) int __stdcall temp(char *value)
{
value="hksdhfs";
return 1;
}
this how i imported in c#
[DllImport("check.dll", CallingConvention = CallingConvention.StdCall, ExactSpelling = true, EntryPoint = "temp")]
public static extern int temp(string value);
the problem is that i am able to send the data thorough the “value” char pointer to the c++ dll, but the value is not being changed when i get “value” char pointer back in c#. Can any one please help.
As the argument is not working in this case so i changed the return type of the c++ dll method like below and getting the string in the written format
and the dll import is like this
doing strcpy() will also work but if i am using the class this pointer character value to be passed that it will not work so i preferred the above way and that worked… Thanks Every one.