2

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?

4

1 に答える 1

2

カーネル エクステンションをビルドするときに、フレームワーク (Kernel.framework 以外) や動的ライブラリとリンクすることはできないと思います。

コードはスーパーバイザー モードで実行されます。LD関連のものは基本的にその段階では手に入りません。

ただし、kext の plist ファイル (OSBundleLibraries) を使用して、他の拡張機能 (/System/Library/Extensions) とリンクすることはできます。

Kernel Extension Programming Topicsドキュメントの「Determine Kext Dependencies」を参照してください。

利用可能なカーネル拡張機能には、I/O 関連のものがたくさんあります。多分あなたはそこに同等のものを見つけるでしょう。

于 2011-11-24T00:05:16.657 に答える