I'm calling a function from a C DLL in .NET(C#).
The func. seems so:
void Sample(char *s)
{
s= calloc(6,1);
strcpy(s, "hello");
}
When I declare this function in C# I use the following notation:
[DllImport("sample.dll", CharSet = CharSet.Ansi)]
public static extern void Sample(out StringBuilder s);
However when I look at the watch window when debugging I can't see s =
"hello". Instead s = null;
And then after using this variable I want to destroy the memory
allocated with calloc in C# side.
Can you help me to solve this problem.