On fuzzy.dll (in the prebuilt Win32 archive), fuzzy_hash_file and fuzzy_hash_stream functions will not work properly if you normally build the program which uses fuzzy.dll with Visual C++.
Cause
Because struct FILE is managed by separate instance of Microsoft CRT, mixing multiple CRTs (multiple versions or Debug/Release builds) causes problems. Internally, POSIX file descriptor is managed by __pioinfo and its entry (struct __crt_lowio_handle_data on UCRT) has corresponding Win32 handle and other information. Since every instance of Microsoft CRT has its own __pioinfo (note: on universal CRT [VS2015 or later], __pioinfo is no longer exported), mixing CRT can cause serious inconsistency problems:
- File opened by
fopen is not considered open.
- Different file is referenced.
Potential Errors Passing CRT Objects Across DLL Boundaries: https://msdn.microsoft.com/en-us/library/ms235460.aspx
Possible Resolution
fuzzy.dll references msvcrt.dll and there's no problem if Win32 program also uses msvcrt.dll. However, this is very unlikely. Programs built on Visual C++ are normally linked against version-specific CRT and/or universal CRT.
Although it's possible to link against version-specific CRT (but not universal CRT; as of September 2017), it's much safer to build fuzzy.dll on Visual C++. At least, linking against universal CRT (new CRT for Windows; ucrtbase.dll and API sets) is required to resolve this issue because there will be no version-related issues anymore (there will be however, Debug/Release DLL issues).
After these changes, Windows build pipeline may be separated from this repository.
On fuzzy.dll (in the prebuilt Win32 archive),
fuzzy_hash_fileandfuzzy_hash_streamfunctions will not work properly if you normally build the program which uses fuzzy.dll with Visual C++.Cause
Because
struct FILEis managed by separate instance of Microsoft CRT, mixing multiple CRTs (multiple versions or Debug/Release builds) causes problems. Internally, POSIX file descriptor is managed by__pioinfoand its entry (struct __crt_lowio_handle_dataon UCRT) has corresponding Win32 handle and other information. Since every instance of Microsoft CRT has its own__pioinfo(note: on universal CRT [VS2015 or later],__pioinfois no longer exported), mixing CRT can cause serious inconsistency problems:fopenis not considered open.Potential Errors Passing CRT Objects Across DLL Boundaries: https://msdn.microsoft.com/en-us/library/ms235460.aspx
Possible Resolution
fuzzy.dll references
msvcrt.dlland there's no problem if Win32 program also usesmsvcrt.dll. However, this is very unlikely. Programs built on Visual C++ are normally linked against version-specific CRT and/or universal CRT.Although it's possible to link against version-specific CRT (but not universal CRT; as of September 2017), it's much safer to build fuzzy.dll on Visual C++. At least, linking against universal CRT (new CRT for Windows;
ucrtbase.dlland API sets) is required to resolve this issue because there will be no version-related issues anymore (there will be however, Debug/Release DLL issues).READMEfor CRT object sharing (adding/MDor/MDdoption; will be committed later)fuzzy.c,edit_distn.candfind-file-size.cpossible to compile on Visual C++After these changes, Windows build pipeline may be separated from this repository.