# 错误(3672)
# 3672-1
# 错误信息
函数 %1!s! 不是外部对象构造函数, 输出变量 %2!s! 不能是外部对象类型或者包含外部对象.
# 产生原因
只有外部对象构造函数的返回值是外部对象类型, 如果其他函数的返回值是外部对象类型, 则产生 3672-1 错误.
# 解决方法
非外部对象构造函数不要用外部对象类型的返回值.
# 示例
model Error_3672_1
class Eo
extends ExternalObject;
function constructor
output Eo eo;
external "C" eo = create_eo();
end constructor;
function destructor
input Eo eo;
external "C" destroy_eo(eo);
end destructor;
end Eo;
function TestFunc
input Real x;
output Eo e = Eo();
end TestFunc;
Eo eo = TestFunc(time);
end Error_3672_1;
# 3672-2
# 错误信息
函数 %1!s! 的局部变量 %2!s! 为外部对象类型, 则变量 %2!s! 必须有绑定方程.
# 产生原因
函数中局部变量为外部对象类型时, 则该变量必须有绑定方程, 否则产生 3672-2 错误.
# 解决方法
为函数中外部对象类型的局部变量提供绑定方程.
# 示例
model Error_3672_2
class Eo
extends ExternalObject;
function constructor
output Eo eo;
external "C" eo = create_eo();
end constructor;
function destructor
input Eo eo;
external "C" destroy_eo(eo);
end destructor;
end Eo;
function TestFunc
input Real x;
output Real y;
protected
Eo e;
algorithm
y = x;
end TestFunc;
Real a = TestFunc(time);
end Error_3672_2;
# 3672-3
# 错误信息
外部对象类 %1!s! 的 constructor 函数中, 输入变量 %2!s! 的类型不能是此外部对象类的类型.
# 产生原因
外部对象构造函数 constructor 中输入的类型为外部对象类型, 则参数 3672-3 错误.
# 解决方法
修改外部对象构造函数 constructor 的输入类型, 使用非外部对象类型作为外部对象构造函数 constructor 的输入.
# 示例
model Error_3672_3
class Eo
extends ExternalObject;
function constructor
input Eo e;
output Eo eo;
external "C" eo = create_eo();
end constructor;
function destructor
input Eo eo;
external "C" destroy_eo(eo);
end destructor;
end Eo;
Eo e = Eo();
end Error_3672_3;
# 3672-4
# 错误信息
外部对象类 %1!s! 的 constructor 函数中, 局部变量 %2!s! 的类型不能是此外部对象类的类型.
# 产生原因
外部对象构造函数 constructor 中有局部变量的类型为外部对象类型时, 则产生 3672-4 错误.
# 解决方法
在外部对象构造函数 constructor 中不要使用外部对象类型的局部变量.
# 示例
model Error_3672_4
class Eo
extends ExternalObject;
function constructor
output Eo eo;
protected
Eo eo1;
external "C" eo = create_eo();
end constructor;
function destructor
input Eo eo;
external "C" destroy_eo(eo);
end destructor;
end Eo;
Eo e = Eo();
end Error_3672_4;