diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 030ccd9d..6dc4e004 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -146,6 +146,9 @@ namespace CppSharp.Generators.CSharp return string.Format("{0}*", array.Type.Visit(this, quals)); } + if (Context.Parameter != null) + return string.Format("global::System.IntPtr"); + Class @class; if (arrayType.TryGetClass(out @class)) { diff --git a/src/Generator/Generators/Template.cs b/src/Generator/Generators/Template.cs index b2a0255b..d43e40cc 100644 --- a/src/Generator/Generators/Template.cs +++ b/src/Generator/Generators/Template.cs @@ -309,8 +309,8 @@ namespace CppSharp.Generators public string Generate() { - //if (Options.IsCSharpGenerator && Options.CompileCode) - // return RootBlock.GenerateUnformatted(Options).ToString(); + if (Options.IsCSharpGenerator && Options.CompileCode) + return RootBlock.GenerateUnformatted(Options).ToString(); return RootBlock.Generate(Options); } diff --git a/src/Generator/Types/Std/Stdlib.cs b/src/Generator/Types/Std/Stdlib.cs index 79e6fecf..bc6b2592 100644 --- a/src/Generator/Types/Std/Stdlib.cs +++ b/src/Generator/Types/Std/Stdlib.cs @@ -94,14 +94,14 @@ namespace CppSharp.Types.Std var type = ctx.ReturnType.Type; ClassTemplateSpecialization basicString = GetBasicString(type); Declaration c_str = basicString.Methods.FirstOrDefault(m => m.OriginalName == "c_str"); - if (c_str == null) + if (!c_str.IsGenerated) c_str = basicString.Properties.First(p => p.OriginalName == "c_str"); var typePrinter = new CSharpTypePrinter(ctx.Driver); if (type.IsPointer() || ctx.Declaration is Field) { - ctx.Return.Write("{0}.{1}({2}).{3}()", + ctx.Return.Write("{0}.{1}({2}).{3}{4}", basicString.Visit(typePrinter), Helpers.CreateInstanceIdentifier, - ctx.ReturnVarName, c_str.Name); + ctx.ReturnVarName, c_str.Name, c_str is Method ? "()" : string.Empty); } else {