devxlogo

Conditional Compilation

Conditional Compilation

In many cross-platform applications, you have code sections that — depending on the target OS and compiler — need to be either concealed or compiled. For example, code that uses Win32 APIs must be concealed from a Unix compiler. However, when code is compiled under Windows, it should be visible to the compiler. It’s possible to write such code by using #ifdef and #ifndef preprocessor directives. For example:

 #ifdef __WIN32__ CreateProcess(

devx-admin

Share the Post: