質問

i'm trying for some purpose to create a .dylib including other .dylib symbol

ex : I have libA.dylib et libB.dylib and i want to make libcore.dylib including libA and libB symbol

I know that I can make libcore.dylib using A.o and B.o

gcc -dynamiclib -Wall -install_name libmycore.dylib -headerpad_max_install_names -o libmycore.dylib ../A/A.o ../B/B.o

then with nm -g libcore.dylib : I can find AFunctions symbol and BFunctions symbol

Now I was wondering if I can build the libcore.dylib using libA.dylib and libB.dylib I tried :

gcc -dynamiclib -Wall -install_name libmycore.dylib -headerpad_max_install_names -o libmycore.dylib -L../A/ -lA -L../B/ -lB

I've got no error compiling of course but the libA and libB symbol are not referenced in libcore juste the dependance with nm -g libcore.dylib I have no symbol

is there a way to do it ?

役に立ちましたか?

解決

I finally found a way to do so :

gcc -dynamiclib -o libmycore.dylib -Wl,-reexport_library,PATH_TO_LIB/libA.dylib -Wl,-reexport_library,PATH_TO_LIB/libB.dylib

not easy to find the right syntax, but everything is "explain" here :

http://www.opensource.apple.com/source/ld64/ld64-85/unit-tests/test-cases/re-export-cases/Makefile

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top