how to allocate memory and access it in s-function
이전 댓글 표시
I allocated memory in sfunction code:
static void mdlStart(SimStruct *S)
{ uint8_T * temp = (uint8_T*)calloc(8, sizeof(uint8_T));
ssSetUserData(S, temp);
}
and free the memory in
static void mdlTerminate(SimStruct *S)
{
uint8_T *temp = ssGetUserData(S);
free(temp);
}
and used it in a output_wrapper function as
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
uint8_T *temp = ssGetUserData(S);
//start message
temp = (uint8_T *)Start_Message;
Msg_ID_Package[1] = temp[0];
Msg_ID_Package[0] = temp[1];
However I am getting linker error LNK2019: unresolved external symbol in the output_wrapper file.
I am not sure what I am doing wrong.
Thank you, Khalid
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Configure C/C++ S-Function Features에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!