Package: zugbruecke
zugbrueckeCalling routines in Windows DLLs from Python scripts running under Linux, MacOS or BSD/ˈt͡suːkˌbʁʏkə/ (German, noun, feminine: drawbridge)Synopsiszugbrueckeis an EXPERIMENTALPython package(currently in developmentstatus 3/alpha). It allows tocall routines in Windows DLLs from Python code running on Unices / Unix-like systemssuch as Linux, MacOS or BSD.zugbrueckeis designed as adrop-in replacement for Python's standard library's ctypes module.zugbrueckeisbuilt on top of Wine. A stand-alone Windows Python interpreter launched in the background is used to execute the called DLL routines. Communication between the Unix-side and the Windows/Wine-side is based on Python's build-in multiprocessing connection capability.zugbrueckehas (limited) support for pointers, struct types and call-back functions.zugbrueckecomes with extensive logging features allowing to debug problems associated with both itself and with Wine.zugbrueckeis written usingPython 3 syntaxand primarily targets theCPythonimplementation of Python.About Wine (fromwinehq.org):Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, MacOS and BSD. Instead of simulating internal Windows logic like a virtual machine or emulator, Wine translates Windows API calls into POSIX calls on-the-fly, eliminating the performance and memory penalties of other methods and allowing you to cleanly integrate Windows applications into your desktop.This project is NEITHER associated NOR affiliated in any way or form with the Wine project.PrerequisitestypeprerequisiteversionuserCPython3.x (tested with 3.{7,8,9,10,11})userWine>= 6.x (tested with regular &staging) - expected to be in the user'sPATHdevelopermingw cross-compilerFor building DLLs against which examples and tests can be run. Latest stable release.Installationbranchstatusinstallationdocumentationmaster (release)pip install zugbrueckedeveloppip install git+https://github.com/pleiszenburg/zugbruecke.git@developAfter installing the package withpip, you may choose to manually initialize theWine Python environmentby runningwenv init. If you choose not to do this,zugbrueckewill take care of it during its first use.ExampleStart an interactive Python session on your favorite Unix(-like) operating system and try the following:importzugbruecke.ctypesasctypesdll_pow=ctypes.cdll.msvcrt.powdll_pow.argtypes=(ctypes.c_double,ctypes.c_double)dll_pow.restype=ctypes.c_doubleprint(f'You should expect "1024.0" to show up here: "{dll_pow(2.0,10.0):.1f}".')You have just witnessedmsvcrt.dll, Microsoft's C standard library (or Wine's implementation of it), in action on Unix.Interested in more?Check theGetting Startedsection inzugbruecke's documentation,Readctypes' documentation,Beyondctypessyntax, learn aboutmemory synchronizationwith thememsyncroutine attribute (or)Have a look atzugbruecke'stest suiteshowcasing its entire range of capabilities.A lot of code, which was written withctypes'cdll,windlloroledllin mind and which runs under Windows, should run just fine withzugbrueckeon Unix (assuming it does not use Windows features not supported by Wine). For more complex calls,memory synchronizationis potentially necessary.Speedzugbrueckeperforms reasonably well given its complexity witharound 0.15 ms overhead per simple callon average on modern hardware. For significantly more complex calls, the overhead can go into several milliseconds.zugbrueckeis not (yet) optimized for speed. Check the latestbenchmarksfor more details.Securityzugbrueckeisnotoriously insecure. Never, ever, run it with root / super users privileges! Do not use it where security matters! For details, check the section onsecurityin the documentation.Need help?See section onGetting Helponzugbruecke's documentation.Bugs & IssuesSee section onBugs and Issuesonzugbruecke's documentation.MiscellaneousFull project documentationatRead the DocsatzugbrueckerepositoryAuthorsChange log (current)(changes in development branch since last release)Change log (past)(release history)Contributing(Contributions are highly welcomed!)FAQLicense(LGPL v2.1)Long-term ideasMissing features(for full ctypes compatibility)Upstream issues(relevant bugs in dependencies)For production environmentsDO NOT run this code (as-is) in production environments unless you feel that you really know what you are doing (or unless you are absolutely desperate)! Being experimental in nature and of alpha quality, it is prone to fail in a number of unpredictable ways, some of which might not be obvious or might not even show any (intermediately) recognizable symptoms at all! You might end up with plain wrong, nonsensical results without noticing it! Verify and cross-check your results!zugbrueckeis usingsemantic versioning. Breaking changes are indicated by increasing the second version number, the minor version. Going for example from 0.0.x to 0.1.y or going from 0.1.x to 0.2.y therefore indicates a breaking change. For as long aszugbrueckehas development status "alpha", please expect more breaking changes to come.If you are relying onzugbrueckein one way or another, please consider monitoring the project:its repository on Github,its mailing listandits chatroom.