Clear Filters
Clear Filters

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

22 views (last 30 days)
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.

Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!