libs: fix 'inconsistent DLL linkage' warnings on Windows
authorTim-Philipp Müller <tim@centricular.com>
Sat, 25 Aug 2018 21:09:12 +0000 (23:09 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 23 Sep 2018 22:23:01 +0000 (23:23 +0100)
commit46ed0f0489896824f45694b5d8fbdfaac8de6504
tree88e076418b3bd1f9c4790000ed25062c6cf3fc3c
parent50038bed79e056eee109572db03113999cc7eb38
libs: fix 'inconsistent DLL linkage' warnings on Windows

For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
16 files changed:
gst/Makefile.am
gst/gstconfig.h.in
gst/meson.build
gst/parse/Makefile.am
libs/gst/base/Makefile.am
libs/gst/base/base-prelude.h
libs/gst/base/meson.build
libs/gst/check/Makefile.am
libs/gst/check/check-prelude.h
libs/gst/check/meson.build
libs/gst/controller/Makefile.am
libs/gst/controller/controller-prelude.h
libs/gst/controller/meson.build
libs/gst/net/Makefile.am
libs/gst/net/meson.build
libs/gst/net/net-prelude.h