FMI Standard allocation is not used
The fmi2Instantiate method passes the fmi2CallbackFunctions which contains an allocator. This allocator should be used for compatibility in different Environments.
In c++ this can be done via placement new
but the constructor must be called manually before calling delete
:
void* serverPtr = callbackFunctions->allocateMemory(sizeof(TcpServer), 1); _tcpServer = new (serverPtr) TcpServer(port);
Note: In c++ it is good practice to use new
and delete
and not to use any custom allocators.