G
gh
Hello,
I have not problems to p\invoke some blittable types (so
as int, long), but String stops me
Could anyone explain me, what's wrong here:
(native.dll, eVC++4.0 SP2, default call convention -
__cdecl)
extern "C" __declspec(dllexport) int getString(WCHAR*&)
{ /*some code here*/ }
(C# code, trying invoke getString)
class A {
[DllImport("native.dll")]
public static extern int getString(ref String s);
void Invoker() {
String str_ = "Terrible news that:";
getString (ref str_); // <-- here I caught exception
}
}
The similar sample code placed in MSDN, why it does not
working??
Best regards.
I have not problems to p\invoke some blittable types (so
as int, long), but String stops me
Could anyone explain me, what's wrong here:
(native.dll, eVC++4.0 SP2, default call convention -
__cdecl)
extern "C" __declspec(dllexport) int getString(WCHAR*&)
{ /*some code here*/ }
(C# code, trying invoke getString)
class A {
[DllImport("native.dll")]
public static extern int getString(ref String s);
void Invoker() {
String str_ = "Terrible news that:";
getString (ref str_); // <-- here I caught exception
}
}
The similar sample code placed in MSDN, why it does not
working??
Best regards.