[vlc-devel] [RFC] Slimming LibVLC down

Pierre d'Herbemont pdherbemont at free.fr
Tue Feb 2 17:30:02 CET 2010


2010/2/1 Rémi Denis-Courmont <remi at remlab.net>:
> There are exactly *two* ways to link:
>  - dynamically (then you are wrong),

See above. (Actually you can weak link, do a dynamic lookup. Darwin
specific, true. See below. and that's probably the reason why I am not
on the same line.)

>  - statically (then it is irrelevant).

It is.

> Did I mention that some packaging systems keep track of exported symbols
> and will detect an error? Oh yes, I did.

Ok, that's something I am not used to, clearly. That probably explains
the rest, and why my reasoning can't scale to linux. Thanks for
clarifying this.

> You can't do that. For the umpteenth time, removing an exported function
> breaks compatibility. That's just how dynamic link resolution works.

It won't break dynamic link resolution! (Ok, I am darwin specific
here, and that explain my reasoning about deprecation. I am surprised
that linux toolchain is not supporting this by default.)

# cat lib.c
extern int funcA() { return 0; }
extern int funcdeprecated() { return 0; }
# cat lib2.c
extern int funcA() { return 0; }
# cat exe.c
int main(void)
{
    funcA();
}
# gcc -dynamiclib lib.c -o libtest.dylib
# gcc exe.c -L . -ltest
# ./a.out
# otool -L a.out
a.out:
	libtest.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.0.0)
# gcc -dynamiclib libtest.c -o libtest.dylib
# ./a.out
# nm libtest.dylib
0000000000000000 t __mh_dylib_header
0000000000000f55 T _funcA
                 U dyld_stub_binder


So works out of the box on darwin. And this is how deprecated symbols
should be handled there. But it's true that on darwin, you generally
embed your framework, and a system symbols deprecation let you fix it
for 2 years before removing it.

>> I think we should balance. And we need to be a bit pragmatic with
>> this, and leave the religion aside.
>
> Yes, lets be pragmatic and follow the way real-world dynamic library link
> resolvers work and packaging system keep track of versions.

Ok. I probably missed the linux dynamic linker limitations ;-) (just
kidding here). I was totally unaware of package system that keeps
track of symbols, thanks for clarifying it.

Pierre.



More information about the vlc-devel mailing list