C++ style comments in s-functions with Linux

13 Ansichten (letzte 30 Tage)
Matt
Matt am 4 Apr. 2013
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.

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 4 Apr. 2013
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 Kommentare
Matt
Matt am 5 Apr. 2013
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 am 5 Apr. 2013
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by