Macos 什么是链接的向上依赖关系?
Macos 什么是链接的向上依赖关系?,macos,ld,Macos,Ld,ld支持指定“OS X上的向上依赖项”的几个选项。这里的向上依赖项是什么 -upward-lx This is the same as the -lx but specifies that the dylib is an upward dependency. -upward_framework name[,suffix] This is the same as the -framework name[,suffix] but also specifies that t
ld
支持指定“OS X上的向上依赖项”的几个选项。这里的向上依赖项是什么
-upward-lx This is the same as the -lx but specifies that the dylib is an upward dependency.
-upward_framework name[,suffix]
This is the same as the -framework name[,suffix] but also specifies that the framework is an upward dependency.
向上的依赖关系与正常的依赖关系顺序相反。假设库“A”中的代码调用库“B”中实现的函数;库“A”依赖于库“B”。现在假设库“B”也包含依赖于库“A”中的代码;这是向上的依赖关系(这通常是一件非常糟糕的事情) 我认为如果您遇到这样的情况,那么您应该通过中介进行间接回调来解决代码中的问题,而不是依赖链接器 回调/中介方案的示例如下所示
假设库“A”中的代码仍然依赖于库“B”,但库“B”具有注册回调函数以执行特定操作的机制。作为中介的第三个模块可以安排通过库“B”的回调调用库“A”中的函数,而不是使库“B”调用库“A”直接。链接器现在只需解析从“a”到“B”的依赖关系,并且在运行时,从“B”到“a”的受控关系是伪造的,而不是在链接阶段需要向上的依赖链。该选项必须具有一些实用性。您有任何示例吗?