简体   繁体   English

是否可以从运行在Wine中的Windows应用程序调用本机Linux API?

[英]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: 这有多种原因,包括:

... ...

  1. 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.

相关问题 使用没有wine的Windows DLL(winelib)运行Linux程序? - Running Linux program using Windows DLL (winelib) without wine? 如何在linux程序和运行Wine(同一台计算机)的Windows程序之间共享内存? - How to share memory between linux program and windows program running through Wine (same computer)? 如何使用WINE在Linux上使用Windows .lib - How to use a windows .lib on linux using WINE Wine上的线程程序崩溃(Windows本机OK) - Threaded program crash on Wine (Windows native OK) 如何检测 Wine 是从 Linux 运行还是从 C++ 中的 mac OS 环境运行? - How to detect is Wine running from Linux or from mac OS environment in C++? 从C ++本机Windows应用程序接收WebRTC调用 - Receiving WebRTC call from a C++ native Windows application 有没有办法从用户模式调用Windows Native API函数? - Is there any way to call the Windows Native API functions from the user mode? 是否可以从为64位代码运行的“任何CPU”编译的.NET应用程序中调用64位本机C ++ DLL文件? - Is it possible to call 64-bit native C++ DLL files from a .NET application compiled for 'Any CPU' running as 64-bit code? 如何将 Python 脚本与 Windows DLL 与 Wine 一起使用 ZEDC9F0A5A5D57793368E37361Z - How to use a Python script with a Windows DLL on Linux with Wine? 如何从Android本机应用程序调用应用程序 - How to call an application from android native application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM