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, QNX Neutrino, or BlackBerry 10 OS).
__QNXNTO__
The target is the QNX Neutrino RTOS or BlackBerry 10 OS.

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 Manifests.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus