Fix builds against glib-2.75.x+ with -Dwarnings=fatal on Visual Studio
Hi,
This updates generate_wrap_init.pl.in
to insert the following into the generated wrap_init.cc
:
...
#ifdef _MSC_VER
#pragma warning ( disable : 4273)
#pragma warning ( push )
extern "C"
{
<C-style prototypes of C library where C++ binding is to be generated against>
...
}
#ifdef _MSC_VER
#pragma warning ( pop )
#endif
...
This is necessary as glib-2.75.x
or later used macros that decorated prototypes in its headers for shared/DLL builds which expand to __declspec(dllimport)
, which will cause C4273
warnings (inconsistent decoration of function prototypes with and without __declspec(dllimport)
) to be raised. Since this warning is harmless for this section of code, I think it would be best to just disable it momentarily.
This will also be needed for the glibmm-2-66
branch.
With blessings, thank you!
Edited by Chun-wei Fan