Browse Source

Better stubs (that actually compile) for std::wstring in C# backend.

pull/28/head
triton 12 years ago
parent
commit
5c982b5a8f
  1. 4
      src/Generator/Types/Std/Stdlib.cs
  2. 26
      src/Runtime/StdString.cs

4
src/Generator/Types/Std/Stdlib.cs

@ -74,12 +74,12 @@ namespace CppSharp.Types.Std @@ -74,12 +74,12 @@ namespace CppSharp.Types.Std
public override void CSharpMarshalToNative(MarshalContext ctx)
{
ctx.Return.Write("StringToPtr");
ctx.Return.Write("new Std.WString()");
}
public override void CSharpMarshalToManaged(MarshalContext ctx)
{
ctx.Return.Write("PtrToString");
ctx.Return.Write(ctx.ReturnVarName);
}
}

26
src/Runtime/StdString.cs

@ -48,4 +48,30 @@ namespace Std @@ -48,4 +48,30 @@ namespace Std
set { }
}
}
public struct WString
{
public IntPtr Instance;
public WString(IntPtr instance)
{
Instance = instance;
}
public static implicit operator string(Std.WString str)
{
return string.Empty;
}
public static implicit operator WString(string str)
{
return new WString(IntPtr.Zero);
}
public char this[ulong index]
{
get { return '0'; }
set { }
}
}
}
Loading…
Cancel
Save