简体   繁体   中英

How to use a Python script with a Windows DLL on Linux with Wine?

I am using a Python script, which is loading a Windows DLL. The following code shows a rough example

import ctypes

Foo = ctypes.WinDLL("./Foo.dll")
foo = Foo.Foo
foo.restype = ctypes.c_int
foo.argtypes = [ctypes.c_int]

print(foo(0))

To use this script without building a *.so library in Linux, I would like to use Wine. The reason is that I do not have the source code of Foo.dll.

Is it possible to use this Python script or a similar built module within Wine while using other modules without Wine?

The easiest way to do what you want to do is to install Python and the Windows version of your other modules within Wine, and do that. To your Python script, everything will look just like it's running on Windows, and the DLL will work.

As far as I know, it's not possible to mix-and-match modules like you suggest in your last questions. There would be little point - most Python modules that run on Linux are deployed in source code form, and work just as well on Linux as they do on Windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM