+#ifndef _INC_PERL_XSUB_H
+#define _INC_PERL_XSUB_H 1
+
#define ST(off) PL_stack_base[ax + (off)]
#if defined(CYGWIN) && defined(USE_DYNAMIC_LOADING)
# define aTHX_ aTHX,
#endif
-#if defined(PERL_CAPI)
+#if (defined(PERL_CAPI) || defined(PERL_IMPLICIT_SYS)) && !defined(PERL_CORE)
# ifndef NO_XSLOCKS
# undef closedir
# undef opendir
# define read PerlLIO_read
# define rename PerlLIO_rename
# define setmode PerlLIO_setmode
-# define stat PerlLIO_stat
+# define stat(buf,sb) PerlLIO_stat(buf,sb)
# define tmpnam PerlLIO_tmpnam
# define umask PerlLIO_umask
# define unlink PerlLIO_unlink
# define socketpair PerlSock_socketpair
# endif /* NO_XSLOCKS */
#endif /* PERL_CAPI */
+
+#endif /* _INC_PERL_XSUB_H */ /* include guard */