S-function builder crash when building
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!