I work on AS/400 which is sometimes non-POSIX. We also need to compile our code on UNIX. We have an issue with something as simple as #include.
On AS/400, we need to write:
#include "*LIBL/H/MYLIB"
On UNIX, we need to write
#include "MYLIB.H"
At the moment we have this (ugly) block at the top of each C/C++ file:
#ifndef IS_AS400 #include "*LIBL/H/MYLIB" /* others here */ #else #include "MYLIB.H" /* others here */ #endif
We would like a unified macro. Is this possible? I don't know how to write it.
Ideally, the resulting syntax would be:
SAFE_INCLUDE("MYLIB")that would expand correctly on each platform.
Please advise.
You can simply #include
some separate header in every of your source files containing that ugly #ifndef
just once. It's a common practice anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With