Opened 12 years ago
Closed 12 years ago
#1826 closed defect (fixed)
Passing built in functions as funargs generates invalid C code
Reported by: | Owned by: | Martin Sjölund | |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description
I tried this with with intString
and stringInt
and they both fail, I'm guessing other built in functions as well. A workaround is to wrap the built in functions in a regular function, but either way should work I think.
Script:
setCommandLineOptions({"+g=MetaModelica"}); loadFile("stringInt.mo"); getErrorString(); Test.test(); getErrorString();
stringInt.mos:
package Test protected function app input F f; input String x; protected partial function F input String inElement; output Integer outElement; end F; algorithm f(x); end app; // Passing this as a funarg instead of stringInt works. function si input String s; output Integer i; algorithm i := stringInt(s); end si; function test algorithm app(stringInt, "123"); end test; end Test;
Change History (2)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.
I don't think you tested this for
intString
, since that actually works. Look into trunk/SimulationRuntime/c/meta/meta_modelica_builtin_boxptr.h; it's quite easy to add the built-ins you need.Fixed in r13003.