XCode:在 kext 中包含框架?
我正在编写的内核扩展需要包含一个框架(DirectIO),因此我在目标属性的“链接库”部分中添加了该框架。然后我将其包含在主源文件中。
问题是,每当我尝试构建它时,它都会出现以下错误:
/Developer/usr/bin/ld_classic: incompatible flag -framework used (must specify "-dynamic" to be used)
我在 Snow Leopard 上使用 XCode 3.2,为 OSX i386 构建。是否可以在 .kext 目标中包含 .framework?
The kernel extension I am writing needs to include a framework (DirectIO), so I added the framework in the "Linked Libraries" section of the target properties. I then included it in the main source file.
The problem is, whenever I try to build it, it gives this error:
/Developer/usr/bin/ld_classic: incompatible flag -framework used (must specify "-dynamic" to be used)
I'm using XCode 3.2 on Snow Leopard, building for OSX i386. Is it possible to include a .framework in a .kext target?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在构建内核扩展时不能链接框架(Kernel.framework 除外)或动态库。
您的代码将在主管模式下运行。 LD相关的东西在那个阶段基本上是没有的。
但是,您可以使用 kext 的 plist 文件 (OSBundleLibraries) 链接到其他扩展 (/System/Library/Extensions)。
请参阅 内核扩展编程主题文档。
可用的内核扩展中有很多与 I/O 相关的内容。也许你会找到一个等价的。
I don't think you can link with a framework (other than Kernel.framework) or a dynamic library when building a kernel extension.
Your code will run in supervisor mode. LD related stuff is basically not available in that stage.
You may however link with other extensions (/System/Library/Extensions), using your kext's plist file (OSBundleLibraries).
See 'Determine Kext Dependencies' of the Kernel Extension Programming Topics documentation.
There's a lot of I/O related stuff in the available kernel extension. Maybe you'll find there an equivalent.