You can only assume that the C89 / 90 code compiles in the Modelica compiler. This is mostly about syntax (if you use Include
annotations or Library="file.c"
).
The functions available depend largely on the C library your compilers are associated with. I believe the Microsoft C library does not contain lgamma
, so it cannot be linked. On Linux / OpenModelica, the lgamma example works like libm
contains a function (it compiles using c90 mode, but implicitly adds a double lgamma(double)
declaration).
The powf
example also compiles, but does not work correctly, since your external "C"
declaration claims to use double floating point precision (and you cannot change this as Modelica 3.2). powf
will read half a and use it as the first argument, then read the second half of a and use it as the second argument. b will be discarded. If you set the compiler flags to std=c99
, an error is detected:
powf.h: 23:15: error: conflicting types for 'powf
Note that if you use Dymola on Windows, you are most likely using Visual Studio. In this case, there is no support for C99, except for parts that were copied from C ++.
source share