Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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).

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).

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.

There are 0 guests and 0 other users also viewing this topic
You are here: