Skip to content

add scary warning to WINDOWS_EXPORT_ALL_SYMBOLS

This is a documentation only PR that adds a warning to WINDOWS_EXPORT_ALL_SYMBOLS and CMAKE_WINDOWS_EXPORT_SYMBOLS mentioning that they essentially break all c++ code that uses the standard library (or indeed other template libraries). This is because (as detailed in the warning) the EXPORT_ALL_SYMBOLS option doesn't preserve the selectany nature of the symbols for template instantiations. And actually even if it was patched so it did things would still be .... annoying.

I thought briefly about patching cmake -E __create_def to actually detect selectany symbols and export them as such, but that would take me multiple days and I really don't want to encourage people to export the universe from their dlls anyway. I'm not even completely sure that would completely fix the issues anyways (it would mean enabling EXPORT_ALL_SYMBOLS would create a situation where some selectany symbols are different from other, identically named, selectany symbols, which would break symbols using #pragma detect_mismatch).

Additional things that could be in the warning:

  • a link to GenerateExportHeader
  • an actual deprecation notice, as turning this option on makes libraries essentially completely broken.

I forget if I need to changelog documentation only changes.

Merge request reports