引用 Objective-C 的 DLL(Windows 上的 GNUStep)
如何从 Objective-C 引用 DLL?我在 Windows 上使用 GNUStep Make 文件。
富有的
How do you reference DLLs from Objective-C? I use GNUStep Make files on Windows.
RIch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哦...这让我回想起。从我遇到过的最常见问题中得出的一些猜测。
如果 GNUStep 的 DLL 在 Windows 上像十年前一样工作,那么您:
像链接任何其他 DLL 一样链接到 DLL。我不记得显式语法,但应该有无数可用的示例
确保主程序(或其他 DLL)对每个 DLL 中的符号有静态引用。
特别是,当编译纯 Objective-C 的东西时,很容易出现 Windows 链接加载器不加载 DLL 的情况,因为它看不到对该 DLL 中任何符号的硬引用。当我在 WebObjects 应用程序中遇到这种情况时,我通常会导出如下内容:
然后在我的主程序中非常具体地引用该符号。该静态引用足以导致链接加载器加载 DLL 并让运行时挂接所有类。
Ooh... this takes me back. A bit of a guess from the most common problem I ever ran into.
If GNUStep's DLLs on Windows work like they did a decade ago, then you:
Link to the DLL like you would any other DLL. I don't remember the explicit syntax, but there should be about a zillion examples available
Make sure you have a static reference to a symbol in each DLL from the main program (or from some other DLL).
In particular, when compiling something that is pure Objective-C, it is quite easy to end up in a situation where the Windows link loader doesn't load a DLL because it doesn't see a hard reference to any symbol in that DLL. When I ran into this with WebObjects applications, I would typically export something like:
And then refer to that symbol quite specifically in my main program. That static reference was enough to cause the link loader to load the DLL and the runtime to hook up all the classes.