GC 应用程序可以链接到 ARC 框架吗?
我有一个使用 GC 进行内存管理的应用程序和一个执行自动引用计数的框架。当我尝试构建它时,我收到此错误:
Linked dylibs built for retain/release but object files built for GC-only for architecture x86_64
是否有正确的方法在此 GC 应用程序中使用 ARC 框架而不更改它?我记得读到过 ARC 代码似乎可以与非 ARC 代码一起工作,但我只找到了每个文件的编译器开关 (-fobjc-arc
)。
I have an application that uses GC for memory management and a framework that does automatic reference counting. When I try to build that, I get this error:
Linked dylibs built for retain/release but object files built for GC-only for architecture x86_64
Is there a correct way to use the ARC framework in this GC application without changing it? I remember to read that ARC code seemslessly works with non-ARC code, but I only find the per-file compiler switch (-fobjc-arc
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不可以。ARC 代码适用于手动保留-释放代码,但不适用于 GC 代码。仅为垃圾收集而构建的框架无法与手动保留释放代码或 ARC 一起使用;以 GC 可选模式构建的框架对两者的工作方式相同。
No. ARC code works with manual retain-release code, but not with GC code. A framework built for garbage collection only will not work with either manual retain-release code or ARC; a framework built in GC-optional mode will work the same with both.