gstreamer/libs/gst/base/base-prelude.h
Tim-Philipp Müller 46ed0f0489 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
2018-09-23 23:23:01 +01:00

36 lines
1.1 KiB
C

/* GStreamer Base Library
* Copyright (C) 2018 GStreamer developers
*
* base-prelude.h: prelude include header for gst-base library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_BASE_PRELUDE_H__
#define __GST_BASE_PRELUDE_H__
#include <gst/gst.h>
#ifndef GST_BASE_API
#ifdef BUILDING_GST_BASE
#define GST_BASE_API GST_EXPORT
#else
#define GST_BASE_API GST_API_IMPORT
#endif
#endif
#endif /* __GST_BASE_PRELUDE_H__ */