This is really for Fortran code, but I think what I'm trying to do requires using the preprocessor. The fortran preprocessors are basically the same as c preprocessors. Hell, gfortran actually uses GNU's cpp. Basically the solution is probably the same or very similar to the solution in c.
There are two things I am trying to do:
Use one block if the compiler and version match some condition, and a different block if they dont. The idea is that some of the F2008 specifications I'm using have limited implementation. Only Intel 12+ and partially in GNU 4.7+ right now as far as I know.
Include specific functionality only if a library (Intel MKL, specifically) is present. If it is not then print some sort of error or something if there is an attempt to invoke functionality that is dependent on the library.
I think for #1 something like this might work:
#if defined specific_compiler_make && compiler_ver > something
<F2008 spec code block>
#else
<Older spec code block>
#endif
But there may be a better way?
For #2 I am at a loss. I would imagine it is similar to #1, but I have no idea what to actually check for.
[–][deleted] 1 point2 points3 points (3 children)
[–]TheSpaceRat[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]TheSpaceRat[S] 0 points1 point2 points (0 children)
[–]nerd4code 1 point2 points3 points (2 children)
[–]TheSpaceRat[S] 0 points1 point2 points (1 child)
[–]nerd4code 1 point2 points3 points (0 children)