Chapter 36. C Language Considerations
FAQ 36.01 What are the main issues when mixing C and C++ code in the same application?
The main issues are
• The C++ compiler must be used to compile main()
. This allows the C++ compiler to deal with static initialization and other magical things that main()
has to do.
• The C++ compiler must be used to direct the linking process. This allows the C++ compilers to deal with templates and also to link in the C++ libraries.
• The C++ and C compilers probably need to come from the same vendor and have compatible versions. This allows them to use compatible calling conventions in the binary code they generate, ...
Get C++ FAQs, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.