[libdvdcss-devel] Again: [PATCH] Re: libdvdcss.so does not distinguish internal from exposed API
Fabian Greffrath
fabian at greffrath.com
Wed Jul 11 10:49:58 CEST 2012
Hello Reimar,
I have changed my mind. Sorry, but I think I was a bit hastly after
reading the GNU document when I proposed the patch yesterday. All this
second-guessing of specific architectures and compiler versions only
makes things more error-prone and less intuitive.
All we need to know is if the currently used compiler supports ELF
visibility - not its version nor architecture, not even if it compiles
to ELF. We check this in the configure script and then somehow need to
get this information into the header. I could not think up of a
different solution than introducing a new #define, which is then
checked for by the preprocessor. This means that this information is
only available at build time of the library itself, but IMHO this is -
in contrast to the __declspec() declarations used by WIN32 and CYGWIN
compilers - perfectly suitable (because symbols are either hidden or
exported at library build time).
Regarding the __declspec() declaration, both MinGW and CYGWIN (not to
even speak of MSVC) compilers are GCC but do not produce ELF object
code and thus - since visibility is an exclusive ELF feature - cannot
support ELF visibility (confirmed myself with mingw at least). So they
have to use the __declspec() declaration, depending on whether
LIBDVDCSS_EXPORTS or LIBDVDCSS_IMPORTS is #defined. If none is them is
defined, something is seriously borked anyway and the preprocessor
falls back to "extern", but it was already like this before.
So please accept the attached patch as my hopefully final approach for
this issue. :)
I have tested building libdvdcss on a current Debian unstable system
with and without my patch and it works, i.e. with the patch 23 symbols
from the _dvdcss_*, ioctl_* and _print_error name space are hidden.
Best regards,
Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libdvdcss-HAVE_VISIBILITY.patch
Type: text/x-diff
Size: 1389 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/libdvdcss-devel/attachments/20120711/8241ce3f/attachment.patch>
More information about the libdvdcss-devel
mailing list