I am trying to call an external C function in modelica with a function as an argument. So the C function needs to take a modelica "function" as input. Is it possible to do that in modelica ?
For example :
function foo
input Function fun;
output Real bar ;
external "C" bar = myCFunction(fun) annotations(...);
end foo;
function Function
input Real u;
output Real y;
algorithm
y := u*2;
end Function;
When I use the "check" option, I get some error stating fun is undeclared which I don't if I do not use a function as input. I looked online and in the use manual of dymola but I haven't found an example stating it was possible, nor impossible.
CodePudding user response:
No, I don't think that's possible. You can check the Modelica Specification about allowed input types to external functions.