在运行时获取指向 Carbon API 的 proc 指针
我有一个 Mac 应用程序,由于各种我无法控制的原因,我必须针对 Mac OS 10.4 SDK 构建该应用程序。鉴于我的应用程序的最低操作系统版本为 10.5。 (我知道,我知道……但我无法提供比上述更多的细节来证明为什么会出现这种情况。)
Mac OS 10.5 SDK 中有一个 API,FSMatchAliasBulk
,我在 10.4 SDK 中找不到一个很好的等效项。知道我将在 Mac OS >= 10.5 上运行,如何在运行时访问 FSMatchAliasBulk
?
I have a Mac application that I must build against the Mac OS 10.4 SDK for various reasons beyond my control. Given that my application's minimum OS version will be 10.5. (I know, I know... but I can't give any more details than the above to justify why this is the case.)
Within the Mac OS 10.5 SDK is an API, FSMatchAliasBulk
, for which I cannot find a good equivalent in the 10.4 SDK. Knowing that I will be running on Mac OS >= 10.5, how can I get access to the FSMatchAliasBulk
at runtime?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,通过从 Xcode 帮助菜单中选择“开发人员文档”来查看 Xcode 帮助中的“交叉开发如何工作”。在文档窗口中,输入“交叉开发如何工作”并按回车键。在那里您将看到更多信息。
我认为您需要执行以下操作:加载 CoreServices 框架,然后获取该函数的函数指针(如果您知道自己在 Mac OS X 10.5 上运行)(请检查 Gestalt 功能以确定这一点)。
这是一个未经测试的示例,但应该会引导您走向正确的方向:
First, check out "How Cross-Development Works" in your Xcode Help by selecting "Developer Documentation" from the Xcode Help menu. In the documentation window, type "How Cross-Development Works" and hit return. There you will see more information.
And here is what I think you'll need to do: load the CoreServices framework and then get the function pointer for that function if you know that you're running on Mac OS X 10.5 (check out the Gestalt functionality to determine that).
Here is a sample that is not tested, but should lead you in the right direction: