S-function builder crash when building

2 Ansichten (letzte 30 Tage)
Lukas Polacek
Lukas Polacek am 24 Jan. 2022
Hello,
I have a problem the S-Function builder crashes the whole matlab and even computer after I click on build with this code. Does anyone idea what is wrong? This function is a sender and receiver of zeroMQ messages. It works but the computer crashes when the builder builds, the files are created succesfully , after restart the program runs.
Thank you
#include <math.h>
#include <zmq.hpp>
#include "iMowCoSimulation.pb.h"
#include "iMowCoSimulation.pb.cc"
zmq::context_t context (1);
zmq::socket_t socket(context,ZMQ_PAIR);
void CommunicationTestSFun_Start_wrapper(void)
socket.connect("ipc:///tmp/cosim_ipc_0");
}
void CommunicationTestSFun_Outputs_wrapper(const real_T *u0,
real_T *y0)
{
std::string msg_str;
iMowCoSimulator::Matlab2Garden M2G;
M2G.set_runtime_ms(10);
M2G.SerializeToString(&msg_str);
zmq::message_t request (msg_str.size());
memcpy ((void *) request.data (), msg_str.c_str(), msg_str.size());
socket.send (request);
zmq::message_t response;
socket.recv(response);
iMowCoSimulator::Garden2Matlab G2M;
std::string msg_resp_string(static_cast<char*>(response.data()), response.size());
G2M.ParseFromString(msg_resp_string);
y0[0] = G2M.time();
}
void CommunicationTestSFun_Terminate_wrapper(void)
{
socket.close();
context.close();
}

Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by