[英]Is it possible to call native Linux API from a Windows application running in Wine?
Scenario 脚本
I have a plugin (dll) written for a Windows application (in C++). 我有一个为Windows应用程序(用C ++编写)的插件(dll)。
That application works fine on Linux under Wine, however, in the plugin I would like to use a feature which is not yet available in Wine. 该应用程序在Wine下的Linux上运行良好,但是,在插件中我想使用Wine中尚未提供的功能。
Assuming I can detect at runtime that the application is running in Wine, can I dynamically load native Linux library (or access native Linux API in any other way) in order to emulate said feature? 假设我可以在运行时检测到应用程序在Wine中运行,我可以动态加载本机Linux库(或以任何其他方式访问本机Linux API)以模拟所述功能吗?
I am curious whether this can be done without any serious hacking. 我很好奇这是否可以在没有任何严重黑客的情况下完成。
Seems like someone has faced similar problem, or at least has predicted such situation. 似乎有人遇到过类似的问题,或者至少已经预测到了这种情况。 Wrapper-library should help you: 包装库应该可以帮助您:
For one reason or another you may find yourself with a Linux library that you want to use as if it were a Windows DLL. 出于这样或那样的原因,您可能会发现自己想要使用Linux库,就好像它是Windows DLL一样。 There are various reasons for this including the following: 这有多种原因,包括:
... ...
- You have a binary only Windows application that can be extended through plugins, such as a text editor or IDE. 您有一个仅限二进制的Windows应用程序,可以通过插件(如文本编辑器或IDE)进行扩展。
In few words - you should create thin Wine builtin-dll, that acts like a bridge between ABI of your PE binary and ABI of native Linux Library. 简而言之 - 您应该创建精简的Wine builtin-dll,它就像PE二进制文件的ABI和本机Linux库的ABI之间的桥梁。 Then you should link your code against this wrapper. 然后你应该将你的代码链接到这个包装器。 For Windows distribution you can provide "wrapper" with empty stubs. 对于Windows发行版,您可以提供带有空存根的“包装器”。 Such approach allows you to use one binary for your plugin, that will use wine-specific functional wrapper DLL on Linux and stub DLL on Windows. 这种方法允许你为你的插件使用一个二进制文件,它将在Linux上使用wine特定的功能包装DLL,在Windows上使用stub DLL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.