[vlc-devel] libvlccore, name-clashes and problems with getopt
Mathieu SCHROETER
mathieu.schroeter at gamesover.ch
Mon Feb 22 11:58:49 CET 2010
Hello,
I'm trying to use libvlc for a project, and there are several potential
clashes with libvlccore. The namespace uses in libvlc.so is fine, always
libvlc_. But libvlc.so is linked against libvlccore.so where the
namespaces are not consistent.
For example, many non-static functions use very common symbols:
$ nm -gC --defined-only /usr/local/lib/libvlccore.so.4.0.0
...
000000000008a540 T module_exists
000000000008a4c0 T module_find
000000000008ae50 T module_gettext
...
00000000000870a0 T msleep
0000000000087140 T mwait
...
000000000009fb60 T xml_Create
...
0000000000085320 T utf8_fprintf
...
etc,...
A second problem is the use of getopt in libvlccore.
$ nm -gC /usr/local/lib/libvlccore.so.4.0.0 | grep opt
U getopt_long@@GLIBC_2.2.5
U getsockopt@@GLIBC_2.2.5
U optarg@@GLIBC_2.2.5
U opterr@@GLIBC_2.2.5
U optind@@GLIBC_2.2.5
U optopt@@GLIBC_2.2.5
U setsockopt@@GLIBC_2.2.5
When using libvlc in a program with getopt.. It is necessary to be
sure that libvlc is initialized _only after_ the use of optind, etc,..
Otherwise, libvlccore changes the value of optind for example,..
I hope that this report will prevent other people to search why getopt
seems doing strange things after the init of libvlc (libvlc_new,
maybe other functions too). IMHO, getopt should never be used in a
library.. the global variables are very annoying..
Regards,
--
Mathieu SCHROETER
More information about the vlc-devel
mailing list