I am working on a project where I try to export FMU (which it is a format used for simulations).
I have a couple of working examples where I manage to export a FMU, but they show an error when I pass a fmuchecker on them.
The failure that I get from fmuchecker is:
[ERROR][FMUCHK] FMU logger callback does not propagate component environment to the application
(this check takes place here)
The logger callback signature is defined here in my code (which is based on this type definition).
Any clue about why I might be getting this failure?
Thanks @Araq. When I try that, the generated C code looks good:
typedef N_CDECL_PTR(void, tyProc__cHW7sT4DDkMwCdiO69bkpDw) (void* c_p0, NCSTRING instanceName_p1, tyEnum_fmi2Status__tRvUjl2s9cdFxDxRk7K39cSA status_p2, NCSTRING category_p3, NCSTRING message_p4, ...);
but I continue having the same error. I don't know why. The issue is that, for some reason, componentEnvironment`within `functions parameter (it is an argument of fmi2Instantiate) is nil.
The procedure fmi2Instantiate is receiving functions: fmi2CallbackFunctions as a parameter where:
type
fmi2CallbackFunctions* = ref object
logger*: fmi2CallbackLogger
allocateMemory*: fmi2CallbackAllocateMemory
freeMemory*: fmi2CallbackFreeMemory
stepFinished*: fmi2StepFinished
componentEnvironment*: fmi2ComponentEnvironment
defined here.
And those types are:
fmi2CallbackLogger* = proc( c: fmi2ComponentEnvironment,
instanceName: fmi2String,
status: fmi2Status,
category: fmi2String,
message: fmi2String) {.varargs.}
fmi2CallbackAllocateMemory* = proc(a1: cuint, a2: cuint)
fmi2CallbackFreeMemory* = proc(a1: pointer)
fmi2StepFinished* = proc(a1: fmi2ComponentEnvironment, a2: fmi2Status)
defined just above.
# typedef void* fmi2ComponentEnvironment;
type
fmi2ComponentEnvironment* = pointer # Pointer to FMU environment
I wonder if the issue might be on how the types above are defined. Can you spot something wrong? In particular, I wonder if I am using exportc where I should.