diff --git a/subprojects/gstreamer/gst/gst.c b/subprojects/gstreamer/gst/gst.c index 2ff100af0d..3f9096197b 100644 --- a/subprojects/gstreamer/gst/gst.c +++ b/subprojects/gstreamer/gst/gst.c @@ -197,18 +197,12 @@ enum * val ::= [0-5] */ -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) && !defined(GST_STATIC_COMPILATION) /* Note: DllMain is only called when DLLs are loaded or unloaded, so this will * never be called if libgstreamer-1.0 is linked statically. Do not add any code * here to, say, initialize variables or set things up since that will only * happen for dynamically-built GStreamer. - * - * Also, ideally this should not be defined when GStreamer is built statically. - * i.e., it should be conditional on #ifdef DLL_EXPORT. It will be ignored, but - * if other libraries make the same mistake of defining it when building - * statically, there will be a symbol collision during linking. Fixing this - * requires one to build two object files: one for static linking and another - * for dynamic linking. */ + */ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) diff --git a/subprojects/gstreamer/libs/gst/net/gstptpclock.c b/subprojects/gstreamer/libs/gst/net/gstptpclock.c index 14355b0d18..b9f1ecfeb9 100644 --- a/subprojects/gstreamer/libs/gst/net/gstptpclock.c +++ b/subprojects/gstreamer/libs/gst/net/gstptpclock.c @@ -72,7 +72,7 @@ #ifdef G_OS_WIN32 #include -static HMODULE gstnet_dll_handle; +static HMODULE gstnet_dll_handle = NULL; #endif #ifdef HAVE_DLFCN_H @@ -2339,18 +2339,12 @@ gst_ptp_is_initialized (void) return initted; } -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) && !defined(GST_STATIC_COMPILATION) /* Note: DllMain is only called when DLLs are loaded or unloaded, so this will * never be called if libgstnet-1.0 is linked statically. Do not add any code * here to, say, initialize variables or set things up since that will only * happen for dynamically-built GStreamer. - * - * Also, ideally this should not be defined when GStreamer is built statically. - * i.e., it should be conditional on #ifdef DLL_EXPORT. It will be ignored, but - * if other libraries make the same mistake of defining it when building - * statically, there will be a symbol collision during linking. Fixing this - * requires one to build two object files: one for static linking and another - * for dynamic linking. */ + */ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)