0

App A requires third-party libraries B and C. Both B and C include different versions of library D (from a further third-party). No third-party source code is available. This will give duplicate symbol errors when linking the app.

What solutions are available?


Related question involving identical libraries, allowing one copy to simply be deleted: How to handle duplicate symbol error from 3rd party libraries?

4

1 回答 1

0

这通过重命名 B 中的冲突符号(以及它的 D 版本,如果单独)来解决。这可以直接在二进制文件上完成,只要重命名的长度与原始文件的长度相同(例如,通过反转库前缀)。

local $/ = "\0";
open my $fh, '<+', $library;
binmode $fh;

while (my $field = <$fh>) {
    my $length = length $field;
    chomp $field;

    if (defined $translation{$field}) {
        seek $fh, -$length, SEEK_CUR;
        print $fh $translation{$field};
    }
}
于 2015-01-27T13:47:20.250 回答