# , StringBuilder, .
:
#include <string.h>
int foo(char *buf, int n) {
strncpy(buf, "Hello World", n);
return 0;
}
#
[DllImport("libfoo", EntryPoint = "foo")]
static extern int Foo(StringBuilder buffer, int capacity);
static void Main()
{
StringBuilder sb = new StringBuilder(100);
Foo(sb, sb.Capacity);
Console.WriteLine(sb.ToString());
}
:
Hello World