Developing Cross‐Platform and Cross‐Language Applications
Marc Gregoire · 2018
This chapter first surveys the platform-related issues that C++ programmers encounter. When a programmer compiles a C++ program, his/her source code is turned into binary instructions that the computer executes. That binary format is defined by the platform, not by the C++ language. One solution to support platforms that are not binary compatible is to build each version separately with a compiler on each target platform. Another solution is cross-compiling. The C++ specification allows for a certain type of compiler-defined language extension through the #pragma mechanism. #pragma is a precompiler directive whose behavior is defined by the implementation. Next, the chapter looks at how C++ can interact with other programming languages. While C++ is a general-purpose language, it may not always be the right tool for the job. Through a variety of mechanisms, a programmer can integrate C++ with other languages that may better serve his/her needs.