Skip to content

Export classes selectively (fix issue #90)

Chun-wei Fan requested to merge std-string-msvc-fixes into master

Hi,

This attempts to fix the glibmm build on Visual Studio so that we can avoid having binaries that depend on a specific STL/compiler version and avoid duplicate symbols as we previously exported classes that derive from std::string, by:

  • Selectively export items from classes that contain members of (not methods returning) the std::string and std::exception types, so that we can avoid having the binaries tied to a specific compiler and STL version. As a result, we need to update any classes that make use of such classes, and update gerror.m4 to do likewise when generating code that uses _WRAP_GERROR.

  • Don't export classes that derive from the std::string class as a whole, but export its methods individually, to avoid duplicate symbols when building items using the glibmm stack (the issue raised by issue #90 (closed)).

  • Clean up the Visual Studio build files, as some warnings that we used to ignore should be also resolved by the updates in this MR.

  • Use /EHsc to replace ignoring warning C4530.

Unfortunately, for fixing issue #90 (closed), one will need to rebuild items that make use of glibmm, but the benefit with the changes here is that code built with Visual Studio 2017 will become ABI compatible with code built with Visual Studio 2019.

With blessings, thank you!

Merge request reports