Opened 16 years ago
Last modified 16 years ago
#1022 closed defect (fixed)
External function with no input parameters do not typecheck!
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | Adrian Pop, Adrian Pop |
Description
Bug pointed out by Alexander.Roehnsch <AT> dlr <DOT> de. Thanks!
I changed ExternalFunc1_ext() to take no arguments. Changed all the signatures and implementations. Like in the C file:
{{{double ExternalFunc1_ext()
{
return 2;
} }}}
And in the model:
{{{function ExternalFunc1
output Real y;
external y=ExternalFunc1_ext()
annotation(Library="libExternalFunc1_ext.o",
Include="#include\"ExternalFunc1_ext.h\"");
end ExternalFunc1;}}}
With a later call to:
der(x)=-ExternalFunc1();
Running the script gives off:
{{{>> runScript("ExternalLibraries.mos")
"
true
0
0
record
resultFile =
"Simulation failed.
No matching function found for ExternalFunc1() of type function() =>
Real,
candidates are function() => Real
Error occured while flattening model ExternalLibraries
"
end record
true"}}}
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Hi,
Have you tried the latest nightly-build?
http://www.ida.liu.se/~pelab/modelica/OpenModelica/OMC/nightly-builds/|http://www.ida.liu.se/~pelab/modelica/OpenModelica/OMC/nightly-builds/
There was an issue with I believe any function having no input parameters,
but I believe I fixed it in the latest nightly build. Give it a try and let me know
so I can reopen the bug if is still present for external objects.
Cheers,
Adrian Pop/
Dear Developers,
I wanted to report my finding that OpenModelica does not seem to be capable of handling a constructor for an external object that does not have an (input) argument.
Not sure if this is a bug or not.
Regards,
Beat Arnet
package ExtObj
end ExtObj;
model testextobj
end testextobj;
record
No matching function found for CGlobals() of type function() => ExtObj.CGlobals ExternalObject, candidates are function() => ExtObj.CGlobals ExternalObject
Error occured while flattening model testextobj
"
end record