Skip to main content

Calling routines in Windows DLLs from Python scripts running under Linux, MacOS or BSD

Project description

master / release

build_master

Documentation Status (master)

development branch

build_develop

Documentation Status (master)

http://www.pleiszenburg.de/zugbruecke_logo.png

Synopsis

zugbruecke is an EXPERIMENTAL Python module (currently in development status 3/alpha). It allows to call routines in Windows DLLs from Python code running on Unices / Unix-like systems such as Linux, MacOS or BSD. zugbruecke is designed as a drop-in replacement for Python’s standard library’s ctypes module. zugbruecke is built 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. zugbruecke has (limited) support for pointers and struct types. zugbruecke comes with extensive logging features allowing to debug problems associated with both itself and with Wine. zugbruecke is written using Python 3 syntax and primarily targets the CPython implementation of Python.

About Wine (from winehq.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.

Prerequisites

for usage

  • CPython 3.x (tested with 3.{5,6}) - no additional Python packages required

  • Wine 2.x (tested with 2.{5,6,10,12} regular & staging) - expected to be in the user’s PATH

for tests

for documentation

Installation

master / release

pip install zugbruecke

development branch

pip install git+git://github.com/pleiszenburg/zugbruecke.git@develop

Examples

Start an interactive Python session under Unix and try the following:

from zugbruecke import cdll, c_double

dll_pow = cdll.msvcrt.pow
dll_pow.argtypes = (c_double, c_double)
dll_pow.restype = c_double
print('You should expect "1024.0" to show up here: "%.1f".' % dll_pow(2.0, 10.0))

You have just witnessed msvcrt.dll in action on Unix. Interested in more? Check the examples in zugbruecke’s documentation or read ctypes’ documentation.

A lot of code, which was written with cdll, windll or oledll in mind and which runs under Windows, should run just fine with zugbruecke on Unix (assuming it does not use Windows features not supported by Wine).

Speed

zugbruecke performs reasonably well given its complexity with less than 0.2 µs overhead per call in average on modern hardware. Check the latest benchmarks for more details.

Security

zugbruecke is notoriously insecure. Never, ever, run it with root / super users privileges! Do not use it where security matters! For details, check the section on security in the documentation.

Need help?

Feel free to post questions in the GitHub issue tracker of this project. Make sure to label them as question.

Bugs & issues

Make sure you have read the chapter on bugs in zugbruecke’s documentation.

Miscellaneous

For production environments

DO 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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zugbruecke-0.0.1.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

zugbruecke-0.0.1-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file zugbruecke-0.0.1.tar.gz.

File metadata

  • Download URL: zugbruecke-0.0.1.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zugbruecke-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8f05a5756cb169e7f7b98bf907630fef50212d432245bb59f5bf410614952fdc
MD5 d097b93300635f1ba250a74e5d2dcf54
BLAKE2b-256 f9bf847a95295d234010ea13a1ff3658a0a325c9b133f1b46d4a8d6ba9d064a8

See more details on using hashes here.

File details

Details for the file zugbruecke-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for zugbruecke-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5684017d7d615e779c7a5b1c9decaea0b59053c2fa6c8057c63e528f4f60702
MD5 0d11a4eafbc00cacdff01b21beb04c2f
BLAKE2b-256 f66b5c7cd7abd03b9f24f030ada429728535feab7ac21f7aea9a26f68aecdc37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page