modules/media: Fix Visual Studio builds with older GLib
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 7 Mar 2023 06:27:06 +0000 (14:27 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 7 Mar 2023 07:36:42 +0000 (15:36 +0800)
commit432e8664e1eb24c81bbcf1927f0de257bae7e038
tree54b3a995bc765c10178c0b6555fc242516526d99
parent6d2c5e51e0d8f002246015f574c93d3a9a494903
modules/media: Fix Visual Studio builds with older GLib

The current definitions of the g_io_module_*() symbols do not build on
Visual Studio when building against GLib earlier than 2.75.0 due to the
way how these symbols are decorated in the GLib headers, as Visual Studio
does not allow symbols that were previously marked with 'extern' (or so)
to be marked with anything that is symantically different later.

As a result, if we are using Visual Studio and glib-2.74.x or earlier,
override _GLIB_EXTERN as appropriate in the modules/media sources before
including the GIO headers.  This sadly, means that we need a
configure-time check as it would have been too late if we checked the
GLib version using G_VERSION_CHECK macro, as the GIO headers would have
been included already.

There are similar items in the print backends, but we will not attempt
to update these files as they are not meant to be built for Windows.
meson.build
modules/media/gtkffmediafile.c
modules/media/gtkgstmediafile.c