0

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?

ajawa
  • 38
  • 5
  • What is the question here? You can install and run windows python using wine. – Colonel Thirty Two Sep 27 '21 at 12:31
  • Oh sorry, I forgot to add the precise question. I'll edit this post. Is it possible to use this python script or a similar built module within wine while using other modules without wine? – ajawa Sep 27 '21 at 12:49
  • Your code is incorrect (after you;d succeed figuring out *Wine* and stuff, it wouldn't workl). Take a look at [\[SO\]: C function called from Python via ctypes returns incorrect value (@CristiFati's answer)](https://stackoverflow.com/questions/58610333/c-function-called-from-python-via-ctypes-returns-incorrect-value/58611011#58611011) to see why. – CristiFati Sep 27 '21 at 17:51

1 Answers1

1

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.