Revision history for Perl distribution Win32-SharedFileOpen

4.04 2020-11-25

    - Hopefully fixed occasional test failures in t/12_variables.t by allowing a
      larger tolerance.

    - Fixed 64-bit compiler warning.

4.03 2018-07-31

    - Fixed broken link for active bugs on the CPAN Request Tracker.

    - Added optional Changes testing (skipped unless AUTHOR_TESTING).

    - Reformatted Changes file as per CPAN::Changes::Spec.

    - Made Perl Critic, Pod and Pod Coverage tests skip unless AUTHOR_TESTING.

    - Added optional POD coverage testing.

    - Added optional Perl::Critic testing.

    - Made code Perl::Critic clean.

    - Simplified and corrected Makefile.PL requirements.

4.02 2014-05-30

    - Simplified repository metadata for cleaner appearance on

4.01 2014-05-19

    - Changed all time() calls to Time::HiRes::time() calls to improve accuracy
      and (hopefully) to fix occasional test failures in t/12_variables.t.

4.00 2014-05-16

    - Fixed occasional test failures in t/10_fsopen_fh_leak.t and
      t/11_sopen_fh_leak.t by avoiding the problem of trying to open a file with
      a pending delete.  Also avoided similar possible test failures in
      t/06_fsopen_access.t, t/07_sopen_access.t and t/12_variables.pod.

    - Added support for the 'R', 'S', 'T' and 'D' characters in the mode string
      argument to fsopen().  These were added to the Microsoft C library
      function _fsopen() in Visual Studio 2012 (VC11), but we can support them
      regardless of which compiler is being used (except for Borland C++) since
      we are emulating the function now.

    - The functionality to automatically retry opening a file if it could not be
      opened due to a sharing violation now works for perls built with the
      Borland C++ compiler as a result of now emulating the _fsopen() and
      _sopen() functions.  The known bug in various t\06_fsopen_access.t tests
      failing with Borland C++ is also resolved by the same change.

    - Rewrote most of the XS code to emulate, rather than directly expose, the
      Microsoft C library functions _fsopen() and _sopen().

      This has been done using the Win32 API function CreateFile() and Perl's
      own exported win32_open_osfhandle() function so that the file descriptors
      thus opened are in the same C RTL DLL as that loaded by perl and hence
      work when imported into PerlIO.  This change means that we can now support
      building this module with a different compiler to that which was used to
      build perl, something that previously failed because the Microsoft-
      specific _fsopen() and _sopen() functions (unlike standard stdio and lowio
      functions) are not redefined to call the versions in perl's C RTL DLL, and
      therefore opened file descriptors in a different C RTL DLL if this module
      was built by a compiler that used a different C RTL DLL.

      It appears that using different compilers (and hence potentially different
      C RTL DLLs) is safe now that the potential problem in doing so has been
      removed, so the rudimentary checks on the compiler versions in Makefile.PL
      have been removed too.  Note, however, that there is still a compatibility
      problem when building this module with Visual Studio .NET 2002/2003 (VC7)
      or earlier if your perl was built with Visual Studio 2005 (VC8) or later:
      see Perl RT#121448.  However, that is quite an unlikely scenario, so it is
      not worth checking for in Makefile.PL.

    - Changed all PerlLIO_*() function calls to the corresponding lowio
      functions (and removed all PerlSIO_*() function calls, which should
      likewise have been the corresponding stdio functions): they should be
      redefined as necessary by perl's header files anyway, which is indeed the
      case in perl-5.8.1 and above, at least -- see the exchanges between myself
      and Jan Dubois on the "perl5-porters" mailing list, 04-05 Mar 2010, for
      more details on this.

    - Added $Trace to @EXPORT_OK.  [Denby Angus <>]

    - Uploaded source code to GitHub and included repository URLs in metadata.

    - Included META.json file in addition to META.yml.

    - Simplified Makefile.PL commands for making a new distribution archive.

    - Bumped minimum required ExtUtils::MakeMaker version to 6.66 to allow
      building with 64-bit perl (otherwise the build fails with errors about
      fakethr.h and perlsfio.h).

    - Reverted to plain old ExtUtils::MakeMaker for building, now that that's
      more fully maintained again.  Module::Install has virtually died a death,
      and Module::Build is no better either.  Require a fairly recent version
      (6.64) to ensure that all parameters used are supported, to save jumping
      through hoops to support earlier versions.  (This should not be a problem
      since ExtUtils::MakeMaker 6.64 is easily installed into Perl 5.8.1 and
      above, that being the whole point of the new choice of minimum supported
      Perl version.)

    - Bumped minimum required Perl version from 5.6.0 to 5.8.1.  This is in line
      with the minimum requirement of the "Perl Toolchain".

3.44 2013-07-08

    - Corrected typo in a comment.

3.43 2012-03-20

    - Updated Module::Install::PRIVATE to version 1.07.

    - Updated Module::Install components from version 1.06 of that distribution.

3.42 2012-02-28

    - Updated Module::Install components from version 1.04 of that distribution.

    - Updated ppport.h using version 3.20 of the Devel::PPPort distribution.

3.41 2009-10-25

    - Updated Module::Install components from version 0.91 of that distribution.

    - Updated ppport.h using version 3.19 of the Devel::PPPort distribution.

3.40 2009-10-11

    - Declare all core module dependencies in the Makefile.PL as well as the
      existing CPAN module dependencies.  [Cf. CPAN RT#50107]

3.39 2008-08-25

    - Updated Module::Install components from version 0.77 of that distribution.

    - Changed the use of "eval { ... };" to test the return value rather than $@
      since under certain circumstances $@ can end up undefined after a failed

    - Changed all Nullxx macros to (XX *)NULL as per Perl core change #33051 and
      various earlier changes.

3.38 2008-07-06

    - Updated Module::Install::PRIVATE to version 1.06 for Makefile.PL

      * Added the magic "OS unsupported" phrase to Makefile.PL's die() message
        so that CPAN Testers report "N/A" rather than "FAIL" on OSes where the
        appropriate C compiler cannot be found.

    - Updated Module::Install components from version 0.75 of that distribution.
      Changed Makefile.PL appropriately to cope with a non-backwards-compatible
      change in the (undocumented) recommends() method.

    - Added full paths to Cygwin tools used when creating the distribution.

3.37 2008-06-30

    - Added the magic "OS unsupported" phrase to Makefile.PL's die() message so
      that CPAN Testers report "N/A" rather than "FAIL" on non-Win32 OSes.

    - Updated ppport.h using version 3.14 of the Devel::PPPort distribution.

3.36 2007-07-10

    - Updated Module::Install::PRIVATE to version 1.05 for Makefile.PL

      * Fixed the compiler version checking on Win32 for Visual Studio 2005
       (VC8), which now uses four numbers separated by dots for its compiler
    - Updated Module::Install components from version 0.65 of that distribution.

    - Updated ppport.h using version 3.11 of the Devel::PPPort distribution.

    - Added comments to MANIFEST file.

3.35 2006-02-14

    - Fixes for building with Borland C++:

      * Added definition of O_RAW which Borland C++ omits;

      * Excluded export of O_RANDOM, O_SEQUENTIAL, O_SHORT_LIVED and
        O_TEMPORARY, which Borland C++ does not support;

      * Restricted the declaration of _fsopen() to MinGW builds only since they
        are the only builds that require it, and Borland C++ objects to it;

      * Disabled the $Max_Time, $Max_Tries and $Retry_Timeout variables'
        functionality for Borland C++ builds since these depend on $^E (the
        Win32 last error code) being set after a C library function call, but
        Borland C++'s C RTL (at least, the one used by perl) does not do this;

      * Skipped various tests of things that are not supported with Borland C++
        builds, namely: the use of the $Max_Time, $Max_Tries and $Retry_Timeout
        variables, the setting of $^E after a C library function call, and the
        use of the O_TEMPORARY flag.

      This module should now build (and test) cleanly with perls built using
      Borland C++ and dmake, except for a couple of known test failures detailed
      in the KNOWN BUGS section of the manpage.

    - Changed various "use MODULE;" lines to be explicit about what is being
      imported, and in particular to not import things that are not required.

      This suppresses various warnings from the test suite when run under Perl
      5.9.3 relating to redefinitions of the constant subroutines that implement
      the O_* flags due to them having been unintentionally imported from Fcntl
      via IO::File as well as having been imported from this module itself.

    - Updated Module::Install::PRIVATE to version 1.04 for Makefile.PL

      * Fixed the handling of user-input relative directory paths so that they
        are converted to absolute paths before use in case the Makefile.PL has
        changed to another directory in the meantime;

      * Renamed lots of methods for a better naming convention.

    - Updated Module::Install components from version 0.56 of that distribution.
      This includes Module::AutoInstall, which supersedes ExtUtils::AutoInstall.
      Changed Makefile.PL appropriately to take advantage of the new features.

    - Updated ppport.h using version 3.08 of the Devel::PPPort distribution.

    - Modified PREOP key in the dist option in Makefile.PL to ensure files are
      all Windows end-of-line format.

    - Corrected spelling mistakes and improved the grammar in some of the

3.34 2005-09-02

    - Changed test scripts from using Test to Test::More for better diagnostic
      output in case of failures.

    - Updated Module::Install::PRIVATE to version 1.03 for Makefile.PL

      * Relaxed the compiler version checking so that only the major version
        numbers have to match (and also the minor version numbers for Visual
        Studio .NET 2002/2003 (VC7) and later, which use C RTL DLLs named
        msvcr70.dll, msvcr71.dll, etc)  [Sisyphus <> on
        the PAR mailing list (];

      * Fixed the parsing of bcc32's output as per Perl core change #24855.

    - Dropped the use of I<> for Perl variables in POD, in line with changes
      made (some time ago) to the perlpod manpage (Perl core change #12542).

    - Corrected spelling mistake: INITIALISATION should be INITIALIZATION.

    - Updated Module::Install and ExtUtils::AutoInstall components from versions
      0.37 and 0.62 of those distributions respectively.

3.33 2005-06-01

    - Updated Module::Install::PRIVATE to version 1.02 for Makefile.PL

      * ExtUtils::AutoInstall command-line options are now better supported,
        fixing problems with custom option handling that did not recognize them;

      * Errors now croak() rather than die() so that the error messages look a
        little more friendly;

      * If the "auto install" checks loaded Test::Builder then that module's
        cleanup diagnostic code is now skipped, which suppresses the somewhat
        confusing (given the context) message

          # Looks like your test died before it could output anything.

        in the event of any subsequent error that causes Makefile.PL to croak().

3.32 2005-03-03

    - Included Module::Install::PRIVATE version 1.01 for Makefile.PL

      * Added code to try to check that on Win32 the same compiler is being used
        to build this module as was used to build perl itself to avoid problems
        with binaries built by different compiler versions loading different C
        RTL DLLs.

    - Added a recommendation for Test::Pod to Makefile.PL to test the POD when
      building these modules.

    - Updated ppport.h using version 3.06 of the Devel::PPPort distribution.

    - Corrected spelling mistake: localise is more properly spelled localize.

    - Fixed up copyright years in all files to reflect which files actually
      changed in each year.

3.31 2004-12-12

    - Moved XSLoader::load() call inside BEGIN subroutine as recommended by the
      XSLoader manpage.  This means that the XSUBs are now installed before the
      rest of the Perl module is compiled, and hence their prototypes are now
      known, and can be checked, during the remaining compilation.

3.30 2004-10-31

    - Removed $Debug variable and introduced new $ErrStr variable.

      Instead of callers having no clue as to why a function failed unless an
      error happens to be in $! and/or $^E or they had $Debug set to a true
      value, they can now inspect the $ErrStr variable to obtain the reason for
      the failure, much like the use of $! and $^E themselves, except that
      $ErrStr will always be set when a function fails, even if the last error
      did not relate to a system call or Win32 API call.

      Note that $! and/or $^E will continue to be set as well wherever they were
      previously being set, so existing code that inspects those variables will
      not be affected.  Callers should simply consider inspecting $ErrStr
      instead in the future.

      The only backwards compatibility issue here is the removal of the $Debug
      variable, which is unlikely to affect most production systems.

    - Updated documentation and tests for these changes.

    - Renamed some functions and macros in the XS and C code to use names that
      are more likely to be unique to this code, namely Win32SharedFileOpen_*()
      for functions and WIN32_SHAREDFILEOPEN_* for macros.

    - Introduced use of *MY_CXT* macros etc for handling static data in the C
      code to make the module thread-safe.

    - Reinstated ppport.h to provide *MY_CXT* macros etc for Perls older than
      5.7.3 (or 5.9.2 in the case of MY_CXT_CLONE).

    - Updated Module::Install and ExtUtils::AutoInstall components from versions
      0.36 and 0.61 of those distributions respectively.

3.19 2004-08-08

    - Added a note to the INSTALL file that if possible the same compiler should
      be used to build this module as was used to build perl itself.

      This module does not function correctly when built using the free Visual
      C++ Toolkit 2003 compiler in conjunction with a perl (e.g. ActivePerl
      Build 810) that was built using Visual C++ 6.0.  (Passing file
      descriptors, errno and other such resources between the different C RTL
      DLLs used by those compilers (msvcr71.dll and msvcrt.dll respectively)
      does not work.)

3.18 2004-08-01

    - Removed standard modules from the list of pre-requisites in Makefile.PL
      (since a minimum required Perl version is given anyway), and included
      ExtUtils::AutoInstall for auto-installing the remainder if necessary.

    - Updated Module::Install components from version 0.35 of that distribution
      and changed Makefile.PL to use abstract_from() now that it is fixed.

    - Changed INSTALL document and Makefile.PL to remove requirement for Visual
      C++, and mention dmake.

    - Fixes for building under MinGW:

      * Added declarations of O_RAW and _fsopen(), which are missing from some
        versions of MinGW;

      * Changed a "#else if" to the more correct "#elif" since gcc does not
        tolerate the former like Visual C++ does.

      This module should now build cleanly with perls built using MinGW and

    - Improved warning and error messages to include the message string for the
      relevant standard C library errno or Win32 API last-error code where

    - Changed return values from the private _fsopen() and _sopen() XSUBs so
      that if they fail when called in list context then they return an empty
      list rather than a single "false" value (which would be seen as "true" in
      list context).  (They are not currently called in list context anyway;
      this is just defensive programming.)

3.17 2004-02-26

    - Use Module::Install as a front-end to ExtUtils::MakeMaker.  The same build
      script can also be used as a front-end to Module::Build in due course
      (once problems building XS modules with Module::Build are ironed out), and
      it also creates a META.yml file that contains a "license" key, which makes use of.

    - Added new test to check for POD errors if Test::Pod is available.

3.16 2004-02-21

    - Separated the two debug modes into a more traditional Boolean debug mode
      emitting warnings about function failures, plus a new Boolean trace mode
      that emits the information regarding what fsopen() and sopen() did.

      This is a change in behaviour, but should only affect users investigating
      errors; it should not affect any production systems.

    - Clarified licence and warranty for the module, and included relevant
      licence files in the distribution.

    - Moved installation instructions to a separate INSTALL file.

    - Added PREOP to the dist option in Makefile.PL to ensure permissions are
      set correctly within the distdir (since they often are not set correctly
      in the top-level directory when working on Windows) to stop CPANTS from
      complaining about bad permissions.

    - Added COMPRESS (and SUFFIX) and ZIPFLAGS to the dist option in Makefile.PL
      to enable "best compression" for gzip when running "nmake dist" and for
      zip when running "nmake zipdist" respectively.

    - Added clean option to Makefile.PL to have the and
      files deleted by "nmake clean".

    - Added MANIFEST.SKIP to stop "nmake distcheck" from producing bogus

    - Moved into lib/Win32/ sub-directory within distribution.
      This is the new layout style produced by h2xs as of version 1.23.

    - Removed ppport.h since no use was being made of it.  (This module contains
      its own portability fixups in order to build on Perl installations back to
      5.6.0, both with and without ithreads.)

3.15 2003-09-24

    - Changed the output of debug information to use warn() rather than simply
      print()ing to STDERR to enable the information to be captured by a
      $SIG{__WARN__} handler if required.

    - Added two tests to exercise the debug output with $Debug to set 2.

    - Renamed some functions in the XS and C code.

    - Reverted the typemap for "const char *" back to the default T_PV.  There
      did not seem to be any point in the custom typemap.

    - Changed tabs to spaces (via "expand -t 4 infile > outfile") to avoid
      irritation when switching between editors that use 4- or 8-space tabs.

    - Changed control-E to caret-E in extended OS error variable name to make
      files "eight bit clean".

    - Updated META.yml via ExtUtils::MakeMaker 6.17.

3.14 2003-07-31

    - Preload some ERROR_* constants that our use()rs might need, otherwise the
      value of $^E gets interfered with when they are autoloaded by
      Win32::WinError in libwin32-0.191 and earlier when using debug builds of

    - Added META.yml (courtesy of ExtUtils::MakeMaker 6.11).

3.13 2003-05-28

    - Regenerated constant() and AUTOLOAD() using h2xs 1.22 with options:
      -n Win32::SharedFileOpen -b 5.6.0
      to change to new constant loading system.

    - Added new constant, O_RAW, which is an alias for O_BINARY.

    - Removed unnecessary use() of Errno from  It is use()d
      by the test suite, though, so left it as a pre-requisite in Makefile.PL,
      and added other modules use()d by the test suite too.

    - Minor cosmetic changes.

3.12 2003-04-30

    - Removed unused "len" argument from constant() function and simplified
      INPUT section of _constant() XS function to use the typemap for "const
      char *".

    - Removed unnecessary "fh" declarations from OUTPUT sections of _fsopen()
      and _sopen() XS functions.

    - Added AUTHOR option to Makefile.PL.  This is used when creating a PPD file
      (nmake ppd).

3.11 2003-03-08

    - Fix for building under Perl 5.6.0: added definitions of IoTYPE_*
      constants.  This module *really* should build under Perl 5.6.0 and above
      now :-)

    - Changed generation of in-line subroutines for autoloaded constants to use
      typeglob assignment rather than eval().  The eval() gave us named, rather
      than anonymous, subroutines, but these subroutines are so simple that
      there is no advantage in them being named, and the typeglob method is

    - Changed the typemap for "const char *" from the default T_PV (which uses
      SvPV_nolen() for INPUT) to a custom T_PV_len (which uses SvPV() for
      INPUT).  This avoids occasional bizarre problems that I cannot reproduce.

    - Removed WHAT'S NEW section from POD, since there is not currently anything
      of note that is very new, and moved the sections on "Filehandles and
      Indirect Filehandles" and "Error Checking" to a "BACKGROUND REFERENCE"
      section near the end of the POD where they belong.

3.10 2003-01-25

    - Fixes for building under perls with PERL_IMPLICIT_CONTEXT and/or
      PERL_IMPLICIT_SYS enabled (e.g. ActivePerl):

      * Added missing pTHX/aTHX macros to debug() function definition/calls to
        fix building under perls with PERL_IMPLICIT_CONTEXT enabled;

      * Added definitions of PerlIO and PerlIO_importFILE() to fix building with
        Perl 5.6.x with PERL_IMPLICIT_SYS enabled;

      * Changed fclose() and close() calls to PerlSIO_fclose() and
        PerlLIO_close() calls respectively to fix building with Perl 5.8.0 with
        PERL_IMPLICIT_SYS enabled.

      This module should now build cleanly with Perl 5.6.0, 5.6.1 and 5.8.0 with
      any combination of PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS enabled or

    - Fixed the remaining fsopen() bug regarding text/binary modes under Perl
      5.8.0 by always setting the C file stream to binary mode before importing
      it into PerlIO, and then pushing a text mode layer on top if required.

    - Speeded up the "12_variables.t" test by reducing the retry times.

3.00 2002-11-02

    - Fixed the fsopen() bug by opening the Perl filehandle in the XS rather
      than passing a file descriptor back from the XS to the Perl and
      effectively fdopen()ing that.  Similarly re-coded sopen()s XS.

    - Restricted the $Debug variable to only allow non-negative integer values
      like the other global variables.  The value 0 means off, 1 produces the
      same debug as previous versions of this module, and 2 produces additional
      information in the event of a failure revealing exactly what failed.

    - Added and improved some tests.

2.12 2002-09-05

    - Fixes for Perl Version 5.8.0:

      * Explicitly quoted Win32::WinError in Makefile.PL, otherwise it now dies
        with an error about 'Bareword not allowed while "strict subs" in use';

      * Explicitly put fdopen()d Perl filehandle into binary mode because it no
        longer inherits this mode from the C filehandle opened in the XS.

    - Removed use() of AutoLoader since no use was being made of it.

    - Improved definition of @EXPORT, @EXPORT_OK and %EXPORT_TAGS.

    - Corrected documentation typos in the README and the POD.

2.11 2002-07-02

    - Imported the INFINITE flag from <winbase.h> like other Win32 modules do,
      rather than defining our own constant, to avoid clashes with them.

    - Added $Max_Time as a better means than $Max_Tries of controlling when to
      give up retrying when a file cannot be opened due to a sharing violation.

    - Allowed the tie()d variables to have the undefined value: this is
      necessary because local()izing a tie()d variable currently leaves it
      tie()d but initially undefined.  It is also useful anyway to indicate the
      variable is not in use.

    - Updated documentation for these changes.

2.10 2002-06-20

    - Implemented the "First-Class Filehandle Trick" in the function new_fh(),
      and re-exported the function gensym() from the Symbol module, for

    - Added $Max_Tries, $Retry_Timeout and INFINITE so that the file open can be
      retried if it failed due to a sharing violation.

    - Updated documentation for these changes.

    - Local()ized the changes made to $! within AUTOLOAD() as per Perl Bug ID
      20020614.002: see for more details.

2.00 2002-05-27

    - Changed arguments and return values of fsopen() and sopen() to require a
      "filehandle" argument and simply return a Boolean, rather than returning
      the filehandle opened.

    - Updated documentation to reflect the changes made to fsopen() and sopen()
      and to document a serious flaw in fsopen() :-(

    - Minor cosmetic changes.

1.00 2001-08-13

    - First released version.

0.01 2001-06-02

    - Original version; created by h2xs 1.21 with options:
      -n Win32::SharedFileOpen