This commit is contained in:
Бондарев Иван 2020-02-09 11:33:37 +01:00
parent 8cabb035b6
commit 536e62e369
2 changed files with 15 additions and 1 deletions

View file

@ -1833,7 +1833,15 @@ namespace PascalABCCompiler.NETGenerator
if (attrs[i].qualifier == SemanticTree.attribute_qualifier_kind.return_kind)
{
var constr = (attrs[i].AttributeConstructor is ICompiledConstructorNode) ? (attrs[i].AttributeConstructor as ICompiledConstructorNode).constructor_info : helper.GetConstructor(attrs[i].AttributeConstructor).cnstr;
mb.SetMarshal(UnmanagedMarshal.DefineUnmanagedMarshal((UnmanagedType)attrs[i].Arguments[0].value));
try
{
mb.SetMarshal(UnmanagedMarshal.DefineUnmanagedMarshal((UnmanagedType)attrs[i].Arguments[0].value));
}
catch(ArgumentException ex)
{
throw new PascalABCCompiler.Errors.CommonCompilerError(ex.Message.Replace(", переданный для DefineUnmanagedMarshal,",""), attrs[i].Location.document.file_name, attrs[i].Location.begin_line_num, attrs[i].Location.begin_column_num);
}
}
else
mb.SetCustomAttribute(cab);

View file

@ -0,0 +1,6 @@
program err0345_marshal;
[Result: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.SafeArray)]
function f1: array of byte;
external 'any.dll';
begin end.