How to call a Library Functions void XXX (void) generated by Simulink/ert_shrlib.tlc using M script

22 次查看(过去 30 天)
I convert a simulink model to a shared library function by Simulink/ert_shrlib.tlc.
The model hava four input, Add1,Add2,Sub1,Sub2, and two output, AddOut, SubOut.
The functions definition in the generated header file is
void dllTest_initialize(void), void dllTest_step(void), void dllTest_terminate(void).
All the ports are defined as structure:
/* External inputs
typedef struct {
XXX
} ExtU_dllTest_T;
/* External outputs
typedef struct {
XX
} ExtY_dllTest_T
The .c file defines the external ports
ExtU_dllTest_T dllTest_U;
ExtY_dllTest_T dllTest_Y;
The dllTest_initialize is
void dllTest_initialize(void)
{
/* Registration code */
/* initialize error status */
rtmSetErrorStatus(dllTest_M, (NULL));
/* external inputs */
(void)memset((void *)&dllTest_U, 0, sizeof(ExtU_dllTest_T));
/* external outputs */
(void) memset((void *)&dllTest_Y, 0,
sizeof(ExtY_dllTest_T));
}
I want know to how to pass a value before calling the dllTest_initialize and dllTest_step.
I can creat a C structure and Pointer using
InputStruc=libstruct('ExtU_dllTest_T',Input);
InputPtr=libpointer('ExtU_dllTest_TPtr',InputStruc);
BUT don't know how to pass it to input ExtU_dllTest_T dllTest_U.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by