mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
win32: Don't use dllexport/import when only building statically
If the prototypes in the public API have dllimport in them when building statically on Windows, the compiler will look for symbols with symbol mangling and indirection corresponding to a DLL. This will cause a build failure when trying to link tests/examples/etc. External users of GStreamer also need to define -DGST_STATIC_COMPILATION if they want to link to static gstreamer libraries on Windows. A similar version of this patch has been committed to all gstreamer repositories. https://bugzilla.gnome.org/show_bug.cgi?id=767463
This commit is contained in:
parent
084bb505f4
commit
48088867db
2 changed files with 15 additions and 3 deletions
10
configure.ac
10
configure.ac
|
@ -188,6 +188,12 @@ fi
|
|||
AC_SUBST(GST_PLUGIN_LIBTOOLFLAGS)
|
||||
AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")
|
||||
|
||||
dnl If only building static libraries, define GST_STATIC_COMPILATION. This is
|
||||
dnl needed only on Windows, but it doesn't hurt to have it everywhere.
|
||||
if test x$enable_static = xyes -a x$enable_shared = xno; then
|
||||
GST_OBJ_STATIC_CFLAGS="-DGST_STATIC_COMPILATION"
|
||||
fi
|
||||
|
||||
dnl building of tests
|
||||
AC_ARG_ENABLE(tests,
|
||||
AS_HELP_STRING([--disable-tests],[disable building test apps]),
|
||||
|
@ -950,8 +956,8 @@ AC_SUBST(GST_LIB_LDFLAGS)
|
|||
dnl GST_OBJ_*
|
||||
dnl default vars for all internal objects built on libgstreamer
|
||||
dnl includes GST_ALL_*
|
||||
GST_OBJ_CFLAGS="\$(GST_ALL_CFLAGS)"
|
||||
GST_OBJ_CXXFLAGS="\$(GST_ALL_CXXFLAGS)"
|
||||
GST_OBJ_CFLAGS="\$(GST_ALL_CFLAGS) $GST_OBJ_STATIC_CFLAGS"
|
||||
GST_OBJ_CXXFLAGS="\$(GST_ALL_CXXFLAGS) $GST_OBJ_STATIC_CFLAGS"
|
||||
GST_OBJ_LIBS="\$(top_builddir)/gst/libgstreamer-$GST_API_VERSION.la \$(GST_ALL_LIBS)"
|
||||
AC_SUBST(GST_OBJ_CFLAGS)
|
||||
AC_SUBST(GST_OBJ_CXXFLAGS)
|
||||
|
|
|
@ -133,7 +133,13 @@
|
|||
* On Windows, this exports the plugin definition from the DLL.
|
||||
* On other platforms, this gets defined as a no-op.
|
||||
*/
|
||||
#ifdef _WIN32 /* Both 32-bit and 64-bit; both GCC and MSVC */
|
||||
/* Macro _WIN32 is defined on 32-bit and 64-bit Windows; by both GCC and MSVC
|
||||
*
|
||||
* NOTE: To link to Windows statically on Windows, you must define
|
||||
* GST_STATIC_COMPILATION or the prototypes will cause the compiler to search
|
||||
* for the symbol inside a DLL
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(GST_STATIC_COMPILATION)
|
||||
# define GST_PLUGIN_EXPORT __declspec(dllexport) extern
|
||||
# ifdef GST_EXPORTS
|
||||
# define GST_EXPORT __declspec(dllexport) extern
|
||||
|
|
Loading…
Reference in a new issue