2

I searched dirent to find C routines

find / -iregex ".*/dirent.h$" 2>/dev/null

Which return series of identical ones

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/dirent.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/dirent.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/dirent.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/dirent.h

How could I ensure which dirent.h is the one my program invoke?

AbstProcDo
  • 19,953
  • 19
  • 81
  • 138

1 Answers1

1

If you get the compiler to show you the code after pre-processing, you should be able to work it out.

So, for example, with gcc, you can write a nominal program.c:

#include <dirent.h>
main(int argc, char **argv){
    return 0;
}

And then run:

gcc -E program.c

and study what it includes.

Related useful info here.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432