Ok, I dind't find out how to change the size of the Simulink underlying type... but I found a work-around.
I have a file DataAccess.c/.h, containing the problem function DataAccess_GetBoolean(...)
The legacy code tool then generated a separate wrapper file for each function, in that case DataAccess_GetBoolean.c/.h, which containts the s-function API functions, and in mdlOutputs(..) calls the hand-code function DataAccess_GetBoolean(...)
In our case, that is where I had to adjust the code by hand and then rebuild:
This is the generated code:
[...]
boolean_T *y1 = (boolean_T *) ssGetOutputPortSignal(S, 0); // this is where the pointer size mismatch caused the problem, because boolean_T is 8-bit and my boolean type is uint32
/* Call the legacy code function */
DataAccess_GetBoolean( u1, *u2, *u3, *u4, y1);
And this is the code with manual modification:
[...]
boolean_T *y1= (boolean_T *) ssGetOutputPortSignal(S, 0);
uint32_T TmpBoolean;
/* Call the legacy code function, using the uint32 pointer */
DataAccess_GetBoolean( u1, *u2, *u3, *u4, &TmpBoolean);
// map boolean value over from uint32 pointer to boolean_T(8 bit) pointer
if (TmpBoolean)
*y1 = 1;
else
*y1 = 0;
After the modification I had to rebuild the legacy code and the wrapper code. The easiest way to do that was to copy the output from the previous legacy code tool run and run them again on the command line... Just looked for ### Start Compiling DataAccess_GetBoolean and grabbed the next two mex calls