viproma/cppfmu

componentEnvironment points to an FMU-Internal data structure

Closed this issue · 2 comments

The componentEnvironment pointer passed to the logger and stepFinished callbacks is wrong. You must pass the pointer given by the simulation environment via the componentEnvironment pointer in the fmi2CallbackFunctions structure.

Change

logger{this, cppfmu::CopyString(memory, instanceName), callbackFunctions, loggerSettings}

to

logger{callbackFunctions.componentEnvironment, cppfmu::CopyString(memory, instanceName), callbackFunctions, loggerSettings}

Thanks for the bug report (and the solution!). I've pushed a fix to master now, can you check whether it fixes the problem for you?

Yes, that fixes the problem. Many thanks for the fix and for this great project!