Skip to content

Commit

Permalink
[Copied from teesseract library, which triggered this while being com…
Browse files Browse the repository at this point in the history
…piled with this lib and several others in a monolithic build.]

fix very nasty obscure crashes inside system std::xhash code when executing Tesseract Init code, loading the 'tesseract_best' English language file(s):

- https://stackoverflow.com/questions/17885060/passing-reference-to-stl-vector-over-dll-boundary

Though we DO NOT cross a DLL boundary with that stuff (all the relevant code is included in one single "monolithic" DLL and none of that C++ stuff got outside!) we still got inexplicable crashes this way.

The KEY to fixing this: you MUST MAKE SURE ALL RELEVANT MSVC PROJECT FILES HAVE THE **EXACT** **SAME** COMPILER SETTINGS: this has now been 'fixed' for Debug/Win32 build mode only as a PoC: we haven't updated all libraries yet, but this was plenty enough to make the basic bulktest run succeed again (instead of crash fatally) when executing mudraw commands, writing to *.ocr.html output files.

Also note another consequence of our C++ compiler settings fiddling:

- https://stackoverflow.com/questions/5004858/why-is-stdmin-failing-when-windows-h-is-included

we applied the `std::max<int>(a, b)` tweak mentioned there instead of looking for the propr place to plonk a NOMINMAX for windows.h as this was faster and easier, also when we consider future compiler settings changing again as we work on our 'update' script for vcxproj files (TODO!)
  • Loading branch information
GerHobbelt committed May 29, 2021
1 parent 513411a commit d4b0ef6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions windows/VS2019/pthread_lib.2019.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<BrowseInformation>false</BrowseInformation>
<SDLCheck>false</SDLCheck>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;PTW32_RC_MSC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down

0 comments on commit d4b0ef6

Please sign in to comment.