S-function builder crash when building

조회 수: 2 (최근 30일)
Lukas Polacek
Lukas Polacek 2022년 1월 24일
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();
}

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by