Headers seem to be a bit different in Apple land and you need to include stddef.h explicitly to the NULL declaration. This also makes the code a bit more correct, as stddef.h is the header in the C standard that defines NULL (https://en.cppreference.com/w/cpp/header/cstddef).