通过 Wine 在 Mono 中使用 P/Invokes
是否可以通过 Wine 在 Mono 中使用原生 Win API 函数? 是否有一些额外的库用于 Mono 和 Wine 之间的交互?
Is it possible to use native Win API functions in Mono through Wine? Are there some additional libraries for interactions between Mono and Wine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
仅当您在 Wine 环境中安装并使用 Windows 版本的 Mono 时,此功能才有效。 不需要额外的库。 但是,影响 Windows 窗体 GUI 的 P/Invoke 可能不起作用,因为 Mono 的 Windows 窗体实际上并不包装本机控件,而是使用完全托管代码实现。
如果你能更具体的话,可能有更好的方法来做你想做的事。
This will only work if you install and use the Windows version of Mono inside the Wine environment. No additional libraries should be needed. However, P/Invoke that affects the Windows Forms GUI likely won't work, because Mono's Windows Forms doesn't actually wrap native controls, but instead is implemented using fully managed code.
There's probably a better way to do what you want, if you could be more specific.
到目前为止我发现的一些有用的花絮:
看起来 Mono does support P/Invoke (往下看一半你会看到关于编组的部分)。
因此,我认为如果 Wine 正确支持您尝试进行的 Win API 调用,它可能会起作用。 您永远无法真正调用本机 Win API 函数,但如果有 Wine 解释,理论上它应该可以工作。 只需确保在 Wine 中运行您的 Mono 项目即可。
您有什么理由不在 Windows 上虚拟化并运行 Mono?
Just some helpful tidbits I've found so far:
Looks like Mono does support P/Invoke (half way down you'll see a section on Marshalling).
So, I think it could potentially work, if Wine correctly supports the Win API call you're trying to make. You'll never really be able to call the native Win API function, but if there's a Wine interpretation, theoretically it should work. Just make sure to run your Mono project inside of Wine.
Any reason you're not virtualizing and running Mono on Windows itself?