I have a Modelica function that calls an external C function. At the moment, I am only able to run it with the setting Advanced.CompileWith64 = 2
I would like to wrap this function in a way that the flag Advanced.CompileWith64
is set to the value 2 before calling the external function, and afterwards it is set to its original value.
Conceptually, something like this:
function myFunctionWithWrapper
...
algorithm
originalFlagValue := readFlag(CompileWith64)
setFlag(CompileWith64, requiredFlagValue) "set Advanced.CompileWith64 = 2"
myExternalFunction(...)
setFlag(CompileWith64, originalFlagValue)
end myFunctionWithWrapper
Is there a way to read and to set a Dymola flag from a Modelica class?
In functions with the annotation __Dymola_interactive=true
you can simply access those flags using their regular path.
function setFlag
protected
Integer old_val;
algorithm
old_val :=Advanced.CompileWith64;
Advanced.CompileWith64 :=2;
// do something
Advanced.CompileWith64 :=old_val;
annotation(__Dymola_interactive=true);
end setFlag;