Thanks very much for the tips Martin.
I cleaned up the function per your suggestions. I also implemented
islink by setting two flags in st_mode if the file is a symlink. The
implementation was a little convoluted, but it might just work.
The current patch does compile for me with just a few compiler warnings,
which I hope can be easily shaken out.
..\..\Modules\posixmodule.c(4794) : warning C4013: 'CreateSymbolicLink'
undefined; assuming extern returning int
..\..\Modules\posixmodule.c(4803) : warning C4133: 'function' :
incompatible types - from 'PyObject *' to 'char *'
..\..\Modules\posixmodule.c(7174) : warning C4113: 'PyObject *(__cdecl
*)(PyObject *,PyObject *,PyObject *)' differs in parameter lists from
'PyCFunction'
The first warning might be a problem. I understand from the docs
(http://msdn.microsoft.com/en-us/library/aa363866.aspx) that all I need
to do is include windows.h, which is already included... but still the
function prototype isn't present. This might be because a preprocessor
declaration of WINVER isn't set high enough... but since the same
executable is built for all versions of Windows, how is this reconciled
in the compiler? |