- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » External Object annotation syntax
External Object annotation syntax
External Object annotation syntax
Hello List,
I'm working on a model that includes a „external object“. The task is to find a implementation that works for Dymola, SimulationX and Open Modelica. I currently have the following annotation syntax to include the c-code:
annotation (
dll="eobj.dll",
Include="#include <eobj.c>");
The annotation "dll="eobj.dll" is used by SimulationX and Dymola can process the "Include=#include <eobj.c>" statement. Unfortunately OpenModelica doesn’t accept this syntax.
My question:
Is there a annotation syntax for OpenModelica, that doesn’t affect the behaviour in Dymola and SimX (Maybe I can tweak the annotation a bit, so that it works for all three applications)
Best Regards,
Frank
Re: External Object annotation syntax
Actually, OpenModelica does accept #include syntax. However, you need to make sure that the c-file is in a directory searched by the compiler (which directory this is, is not specified by the MLS 3.1; for Windows OpenModelica, just put the file in OPENMODELICAHOME/include/omc).
- sjoelund.se
- 1700 Posts
Re: External Object annotation syntax
With revision 8329, this now compiles even if the functions are non-static (no more linker problems due to multiple copies of the functions).
Note that included C-code will still be compiled using g++ and as such it is subject to more checks than in Dymola and SimulationX (void* for example from malloc needs to be explicitly cast to the correct type).
- sjoelund.se
- 1700 Posts
Re: External Object annotation syntax
thanks, I'll cleanup my code.
As far as I remenber you told me, that the "LibraryDirectory" and "IncludeDirectory" annotations are currently not supported.
Is the implementation of these two annotations already on the todo list?
Frank
Re: External Object annotation syntax
They should be, but I think Media support is higher on the list and will take some time to implement.
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » External Object annotation syntax