C++ style comments in s-functions with Linux

13 次查看(过去 30 天)
I am using Simulink s-functions that have C++ style comments (// instead of /**/). See this answer for context ( http://www.mathworks.com/matlabcentral/answers/8870-c-comments-in-mex-files-under-linux)
I have changed the CFLAGS option in the mexopts file as recommended in the above link and can mex the S-functions no problem. However, when I run the model in rapid accelerator mode, it appears to recompile the s-functions and uses -ansi instead of -std=c99. I traced it back to unixtools.mk, which changes the CFLAGS based on the value of TGT_FCN_LIB in the makefile. Apparently, TGT_FCN_LIB takes the value of ANSI_C, ISO_C, or GNU and the CFLAGS change accordingly. TGT_FCN_LIB is set in the MODEL.mk makefile (located in the slprj folder), but I am not sure what parameter in the model's configuration parameters determines its value (if any). I manually changed it to ISO_C in MODEL.mk and everything compiles fine.
Is there a recommended way to address this problem? I have found a solution, but it involves manually changing the MODEL.mk file or actually changing the default raccel tmf file, both of which seem sketchy to me.

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2013-4-4
My guess is that the option is tied to the Code Generation>Interface>Code replacement library setting in the Configuration Parameters window. Do you get what you need if you change this setting to 'C99 (ISO)'?
  2 个评论
Matt
Matt 2013-4-5
Thanks for the answer. Unfortunately, this did not work. Also, I only get this option in the configuration parameters when I have the Simulink Coder installed, which isn't usually the case for me.
Kaustubha Govind
Kaustubha Govind 2013-4-5
Matt: Sorry that didn't work. I'm out of ideas at this point. Perhaps you can try contacting MathWorks Tech Support to see if they have any idea? My guess is that you may have limited customizability, since this is the Rapid Accelerator target, and not a Simulink/Embedded Coder target.

请先登录,再进行评论。

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by