0

I'm coming from a windows background so I'm a bit new here, but I'm trying to conditionally use mmap() but only if the platform supports it.

I know now it's a POSIX standard, and I'd like to check for it in my code. However, I'm confused as to the best way to do it.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html

Looking here it says this: CHANGE HISTORY First released in Issue 4, Version 2.

I don't know how to translate to an #if check.

I want to check the POSIX version to make sure its defined and at minimum the version in which mmap is supported.

Google doesn't seem to be much help here.

#if ?????
// code to use mmap()
#endif

That's what I want. Just the ???? part

Thanks in advance.

2
  • 2
    Does this answer your question? How can I determine if the operating system is POSIX in C? i.e. _POSIX_VERSION should be #defined in <unistd.h>. There is also _POSIX_C_SOURCE, to be defined by you in order to ensure symbols for a given version are visible (or, as the case may be, not). Commented Jan 5, 2021 at 17:04
  • aha the second answer unistd.h _POSIX_VERSION thanks. I still don't know which version to check for, but at least I have more information than I started with. I appreciate it. Commented Jan 5, 2021 at 17:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.