OS X: Any way to DELAY loading of a DEPENDENT library (.dylib)?

◇◆丶佛笑我妖孽 提交于 2019-12-04 11:13:45

You mean lazy linking:

ld -o test test.o -lazy_library /usr/lib/libz.dylib
ld -o test test.o -lazy-lz

Both load the Zlib compression library when a routine from it is first run. The problem is not to run the routines from your custom library before the initialization is finished.

Weak linking means "if library is missing, set all its symbols to NULLs, don't halt".

NOTICE: replace Zlib (/usr/lib/libz.dylib) with your library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!