Does the S32DS support mixed C and C++ programming?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does the S32DS support mixed C and C++ programming?

Jump to solution
765 Views
lkq1994
Contributor I

Does the S32DS support mixed C and C++ programming?

0 Kudos
Reply
1 Solution
730 Views
Mehul_Patel_NXP
NXP Employee
NXP Employee

Hi, @lkq1994 ,

From an IDE perspective - files ending .c and .cpp may be treated differently. Usually in the settings for build, there are settings for the C compiler and settings for the C++ compiler.

From a programming perspective, yes, C and C++ may be mixed but any references to routines compiled as C code need to be guarded with extern "C" declarations. extern "C" tells the C++ compiler to not "mangle", that is, decorate the function or symbol name in any way. That way, the name of the C symbol is preserved exactly as the programmer wrote it and the C++ code will reference the C code by its "unmangled" name.

Plus, you can find many article and information about C and C++ programming on eclipse platform with Google search, that may be helpful. 

Hope you find the information helpful.

Thank you. Best regards. 

- Mehul Patel

 

View solution in original post

0 Kudos
Reply
2 Replies
662 Views
Mehul_Patel_NXP
NXP Employee
NXP Employee

Hi, @lkq1994 , 

Please let us know if you required further help or guidance. 

Thank you. Best regards. 

- Mehul

0 Kudos
Reply
731 Views
Mehul_Patel_NXP
NXP Employee
NXP Employee

Hi, @lkq1994 ,

From an IDE perspective - files ending .c and .cpp may be treated differently. Usually in the settings for build, there are settings for the C compiler and settings for the C++ compiler.

From a programming perspective, yes, C and C++ may be mixed but any references to routines compiled as C code need to be guarded with extern "C" declarations. extern "C" tells the C++ compiler to not "mangle", that is, decorate the function or symbol name in any way. That way, the name of the C symbol is preserved exactly as the programmer wrote it and the C++ code will reference the C code by its "unmangled" name.

Plus, you can find many article and information about C and C++ programming on eclipse platform with Google search, that may be helpful. 

Hope you find the information helpful.

Thank you. Best regards. 

- Mehul Patel

 

0 Kudos
Reply