[英]How to use a Python script with a Windows DLL on Linux with Wine?
我正在使用 Python 腳本,該腳本正在加載 Windows DLL。 以下代碼顯示了一個粗略的示例
import ctypes
Foo = ctypes.WinDLL("./Foo.dll")
foo = Foo.Foo
foo.restype = ctypes.c_int
foo.argtypes = [ctypes.c_int]
print(foo(0))
要使用此腳本而不在 Linux 中構建 *.so 庫,我想使用 Wine。 原因是我沒有Foo.dll的源碼。
在使用其他沒有 Wine 的模塊時,是否可以在 Wine 中使用這個 Python 腳本或類似的內置模塊?
最簡單的方法是在 Wine 中安裝 Python 和 Windows 版本的其他模塊,然后執行此操作。 對於您的 Python 腳本,一切看起來就像在 Windows 上運行一樣,並且 DLL 將工作。
據我所知,不可能像您在上一個問題中建議的那樣混合搭配模塊。 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.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.