diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 01ffdc99..7ac511dd 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -1956,27 +1956,11 @@ namespace CppSharp.Generators.CSharp if (copyCtorMethod == null) throw new NotSupportedException("Expected a valid copy constructor"); - // Call the copy constructor. - TypeMap typeMap; - if (!copyCtorMethod.IsGenerated && Driver.TypeDatabase.FindTypeMap(@class, out typeMap)) - { - var context = new CSharpMarshalContext(Driver) - { - ArgName = "native", - ReturnVarName = "ret", - ReturnType = new QualifiedType(new TagType(@class)) - }; - typeMap.CSharpMarshalCopyCtorToManaged(context); - WriteLine(context.SupportBefore); - } - else - { - // Allocate memory for a new native object and call the ctor. - WriteLine("var ret = Marshal.AllocHGlobal({0});", @class.Layout.Size); - WriteLine("{0}.Internal.{1}(ret, new global::System.IntPtr(&native));", - QualifiedIdentifier(@class), GetFunctionNativeIdentifier(copyCtorMethod)); - WriteLine("return ret;"); - } + // Allocate memory for a new native object and call the ctor. + WriteLine("var ret = Marshal.AllocHGlobal({0});", @class.Layout.Size); + WriteLine("{0}.Internal.{1}(ret, new global::System.IntPtr(&native));", + QualifiedIdentifier(@class), GetFunctionNativeIdentifier(copyCtorMethod)); + WriteLine("return ret;"); } else { diff --git a/src/Generator/Types/TypeMap.cs b/src/Generator/Types/TypeMap.cs index d4574978..cedd4b23 100644 --- a/src/Generator/Types/TypeMap.cs +++ b/src/Generator/Types/TypeMap.cs @@ -44,7 +44,7 @@ namespace CppSharp.Types } /// - /// Determines if the type map performs marshalling or only replaces copy ctors. + /// Determines if the type map performs marshalling or only injects custom code. /// public virtual bool DoesMarshalling { get { return true; } } @@ -65,11 +65,6 @@ namespace CppSharp.Types throw new NotImplementedException(); } - public virtual void CSharpMarshalCopyCtorToManaged(MarshalContext ctx) - { - - } - /// /// Used to construct a new instance of the mapped type. ///