有没有办法将我的程序与Wine编译的部分联系起来?

sea*_*eas 3 c++ linux gcc wine

我试图在Linux中使用Windows DLL功能.我目前的解决方案是一个单独的wine应用程序的汇编,它使用dll并在dll和主应用程序之间通过IPC传输请求/响应.

这很有效,但与简单的dll调用相比,这是一个真正的开销.

我看到wine编译的程序通常是一个bootstrapping脚本和一些.so,它(根据文件实用程序)是普通的linux动态链接库.

有没有办法将.so直接链接到我的应用程序?有手册吗?

Ign*_*ams 6

您可以使用Winelib编写可以使用Windows DLL的Linux应用程序.

编辑:

备查:

libtest.c:

#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[])
{
  HMODULE h;

  h = LoadLibrary("cards.dll");
  printf("%d\n", h);
}
Run Code Online (Sandbox Code Playgroud)

执行:

$ winegcc -m32 libtest.c 
$ ./a.out
536936448
Run Code Online (Sandbox Code Playgroud)

  • 在wine/windows/winbase.h中甚至没有`LoadLibrary()`和`GetProcAddress()`函数? (4认同)