Including OS-specific code

If you need to include OS-specific code in your application, you can wrap it in an #ifdef to make the program more portable.

The qcc utility defines these preprocessor symbols (or manifest constants):

__QNX__
The target is a QNX operating system (QNX 4 or QNX Neutrino).
__QNXNTO__
The target is the QNX Neutrino RTOS.

For example:

#if defined(__QNX__)
   /* QNX-specific (any flavor) code here */

   #if defined(__QNXNTO__)
      /* QNX Neutrino-specific code here */
   #else
      /* QNX 4-specific code here */
   #endif
#endif

For information about other preprocessor symbols that you might find useful, see the Manifests chapter of the QNX Neutrino C Library Reference.