Fixed native-to-managed marshaling for strings.
This commit is contained in:
Родитель
8811dbb99f
Коммит
38c14d0e7c
|
@ -97,19 +97,23 @@ namespace MonoManagedToNative.Generators
|
|||
public CMarshalNativeToManaged(MarshalContext marshalContext)
|
||||
: base(marshalContext)
|
||||
{
|
||||
}
|
||||
|
||||
bool HandleSpecialCILType(CILType cilType)
|
||||
{
|
||||
var type = cilType.Type;
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
Context.Return.Write("{0}", Context.ArgName);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HandleSpecialCILType(CILType cilType)
|
||||
{
|
||||
var type = cilType.Type;
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
var argId = CGenerator.GenId(Context.ArgName);
|
||||
var domainId = CGenerator.GenId("mono_domain");
|
||||
Context.SupportBefore.WriteLine("MonoString* {0} = mono_string_new({1}, {2});",
|
||||
argId, domainId, Context.ArgName);
|
||||
Context.Return.Write("{0}", argId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool VisitCILType(CILType type, TypeQualifiers quals)
|
||||
|
|
Загрузка…
Ссылка в новой задаче