fopen$UNIX2003 在外部库中失败 [英] fopen$UNIX2003 fails inside external library

查看:28
本文介绍了fopen$UNIX2003 在外部库中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个外部静态库(我也有源代码),它使用fopen"来访问文件系统上的文件.奇怪的是,当它尝试使用 fopen$UNIX2003 内的 EXE_BAD_ACCESS(不在 fopen, 当抛出异常时,fopen 甚至不在调用堆栈中.我尝试直接使用 fopen 自己使用相同的路径/选项并且它有效.所以,首先,库是否有可能以某种方式调用不同的 fopen 实现?如果是这样,为什么,最重要的是如何让它调用正确"的实现?

I have an external static library (I have the source code as well) that uses 'fopen' to access files on the filesystem. The strange thing is that it always fails both on simulator and device when it tries to do so with EXE_BAD_ACCESS inside fopen$UNIX2003 (not in fopen, fopen is not even in the call stack when the exception is thrown. I've tried to use fopen directly myself with the same path/options and it works. So, first of all, is it possible that the library is somehow calling a different fopen implementation? If so, why, and most important how can I make it call the 'right' one?

实际上,抛出异常之前调用堆栈中的最后一个函数是_interposition_vtable_unimplementedfopen$UNIX2003 在它之前.

Actually, the last function in the call stack before the exception is thrown is _interposition_vtable_unimplemented, fopen$UNIX2003 precedes it.

推荐答案

fopen$UNIX2003 是 OS X 提供的一个符号,它不是 iOS 模拟器运行时的一部分.iOS 始终一致,因此没有旧版(非 $UNIX2003)函数变体(提供这些变体是为了与针对旧版本 OS X SDK 构建的代码兼容).

fopen$UNIX2003 is a symbol that is provided by OS X and is not part of the iOS Simulator runtime. iOS is always conformant and thus does not have legacy (non $UNIX2003) variants of functions (which are provided for binary compatibility with code built against older versions of the OS X SDK).

您所看到的问题的常见原因是您有一个针对 OS X SDK 构建的对象文件或存档 (libsomething.a),并试图将其链接到您的 iOS 模拟器可执行文件中.这不受支持,因为这两个平台在该层不是二进制兼容的.

The common cause of the issue you are seeing is that you have an object file or archive (libsomething.a) that was built against the OS X SDK and are trying to link it into your iOS Simulator executable. That is not supported as the two platforms are not binary compatible at that layer.

您需要针对 iOS Simulator SDK 重建您的库(libsomething.a).

You need to rebuild your library (the libsomething.a) against the iOS Simulator SDK.

这个问题在 iOS 7 上导致运行时中止,但现在在 iOS 8 上构建时出现链接错误,这似乎有助于使这些问题更加明显.

This problem results in an abort at runtime on iOS 7 but is now a link error at build time on iOS 8, and that seems to have helped make these issues much more obvious.

这篇关于fopen$UNIX2003 在外部库中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆