1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

build: add a hack to prevent name collision with libtalloc

libsmbclient uses dynamically linked libtalloc.so which has symbols
with names matching those in the internal talloc.c. This name
collision caused a crash under stream_smb when trying to play
anything with smb://. Add a "#pragma GCC visibility" hack to talloc.h
to hide the internal symbols from being visible to the outside
libtalloc.so. Hopefully this doesn't break any platform worse than
possibly causing a compiler warning about an unknown pragma (at least
GCC and clang recognize it).
This commit is contained in:
Uoti Urpala 2011-07-07 23:19:39 +03:00
parent 8a37558c5f
commit 6794bca0e9

View File

@ -29,6 +29,14 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
/* HACK: libsmbclient uses dynamically linked libtalloc.so which has
* identically named symbols. This name collision caused a crash under
* stream_smb when trying to play anything with smb://. This hack
* prevents the symbols declared here from being visible to outside
* shared libraries and fixes the crash.
*/
#pragma GCC visibility push(hidden)
/* this is only needed for compatibility with the old talloc */ /* this is only needed for compatibility with the old talloc */
typedef void TALLOC_CTX; typedef void TALLOC_CTX;
@ -180,4 +188,6 @@ char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3)
char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
// end of visibility hack from above
#pragma GCC visibility pop
#endif #endif