Does OSQP solver could be built in matlab function in Simulink?

Hi,

I want to use OSQP in the Simulink, so I built a matlab function for calculating a Quadratic programming.
And then I got some errors as shown below:

Function call resolved to MEX file ‘C:\WECCC\OSQP\osqp-matlab\osqp_mex.mexw64’. Only MATLAB files are supported for code generation. Consider using coder.extrinsic to declare MEX function as extrinsic.

Function ‘osqp.m’ (#568.2055.2083), line 59, column 33:
“osqp_mex(‘new’, varargin{:})”
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Function call failed.

Function ‘Controller/Rotary/WECCCOMP Controller/MPC_controller/controller/MATLAB Function’ (#642.214.218), line 15, column 8:
“osqp”
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Undefined function or variable ‘prob’. The first assignment to a local variable determines its class.

Function ‘Controller/Rotary/WECCCOMP Controller/MPC_controller/controller/MATLAB Function’ (#642.239.243), line 18, column 1:
“prob”
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Undefined function or variable ‘prob’. The first assignment to a local variable determines its class.

Function ‘Controller/Rotary/WECCCOMP Controller/MPC_controller/controller/MATLAB Function’ (#642.350.354), line 22, column 7:
“prob”
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
Undefined function or variable ‘res’. The first assignment to a local variable determines its class.

Function ‘Controller/Rotary/WECCCOMP Controller/MPC_controller/controller/MATLAB Function’ (#642.369.372), line 24, column 5:
“res”
Launch diagnostic report.

Does anyone know whether OSQP can be used in Matlab function block.

BR
DD