Changing _ITERATOR_DEBUG_LEVEL directly affects the internal layout and binary representation of STL containers such as std::vector, std::string, etc., in MSVC. When debug iterator support is enabled (usually with _ITERATOR_DEBUG_LEVEL = 2), additional members, debug checks, and bookkeeping structures are added to STL containers to monitor iterator validity and container boundaries. These extra fields and mechanisms alter the size and memory layout of these types compared to release builds where _ITERATOR_DEBUG_LEVEL = 0, which omits these debug helpers.
These changes make debug builds more robust against invalid iterator usage but prevent reliable interoperation with release builds or code compiled with a different debug level. It’s strongly advised not to share STL objects across build boundaries unless build settings (including _ITERATOR_DEBUG_LEVEL) match exactly on both sides.
In summary, _ITERATOR_DEBUG_LEVEL modifies STL container layouts by adding extra members and debug infrastructure for iterator checking, making their representation incompatible between debug and release builds in MSVC.
If you use STL in your Windows add-ons, set _ITERATOR_DEBUG_LEVEL to 0, as you can see in the CMakeLists.txt files accompanying the example add-ons, or as in SetGlobalCompilerDefinitions in https://github.com/GRAPHISOFT/archicad-addon-cmake-tools/blob/main/CMakeCommon.cmake, and link to ACAP_STAT.lib even in debug builds.