We have some code originally developed for QNX SDP 6.6 that we are porting to QNX SDP 7.0 (7.1 does not yet have the board support packages we need).
As part of the porting effort, we are finding things that have been removed in 7.1, such as getprio()
to retrieve the process priority. Now I know what that need to be replaced with but, in the interest of minimal impact to the code base, I went looking for a pre-processor variable to indicate whether I'm compiling with SDP 7.0 or something earlier.
That way, I could simply use #ifdef
to select which code to compile, along the lines of __STDC_VERSION__
to figure out which ISO iteration applies.
However, I can't find anything in the QNX docs that seem relevant. I found __QNX__
and __QNXNTO__
which together let me figure out whether it's non-QNX, QNX 4, or QNX Neutrino, but nothing that appears to detect a difference between QNX 6 and 7.
Is there such a beast available?
It appears there is a preprocessor macro for it.
Specifically, you include
<sys/neutrino.h>
for QNX 6.6 or 7.0, or<sys/nto_version.h>
for QNX 7.1. I don't have access to others but would expect the scheme to continue.You can then test
_NTO_VERSION
which is defined asVRR
, whereV
is the major version andRR
is the revision.The following transcript shows the relevant header file content: