pharo-project / pharo-vm

This is the VM used by Pharo
http://pharo.org
Other
115 stars 71 forks source link

Unresolved external symbol S_ISDIR when compiling using MSVC #753

Closed syrel closed 5 months ago

syrel commented 8 months ago

Hi The following commit https://github.com/pharo-project/pharo-vm/commit/e2c5e056a793fb7d21c506713d441d62c8b9d76a introduced a regression on Windows because S_ISDIR is a POSIX macros which is not available on Windows:

https://github.com/pharo-project/pharo-vm/blob/e2c5e056a793fb7d21c506713d441d62c8b9d76a/src/imageAccess.c#L192-L200

It is recommended to add the following compatibility definition after #include <sys/stat.h> when compiling for Windows using MSVC:

#ifdef _WIN32
    #ifndef _S_ISTYPE
        #define _S_ISTYPE(mode, mask)  (((mode) & _S_IFMT) == (mask))
        #define S_ISREG(mode) _S_ISTYPE((mode), _S_IFREG)
        #define S_ISDIR(mode) _S_ISTYPE((mode), _S_IFDIR)
    #endif
#endif
guillep commented 8 months ago

Hi @syrel , thanks for checking this! Indeed, we don't have the MSVC build integrated in our CI yet, that's why we did not see it.

Would you mind issuing a PR? Thanks a lot!