Skip to main content

PyMemoryModule is a Python binding for MemoryModule.

Project description

PyMemoryModule

PyMemoryModule is a Python binding for MemoryModule.

Build status

By this module, you can load DLL completely from memory - without storing on the disk first - all thanks to MemoryModule written by Joachim Bauch.

How to install

pip install pymemorymodule

Packages are available at PyPI and PyPI test.

How to use

import pymemorymodule as pymm
from ctypes import cast, c_int, CFUNCTYPE

with open("path/to/library.dll", "rb") as fp:
    # Load DLL from bytes object
    handle = pymm.MemoryLoadLibrary(fp.read())

    # __declspec(dllexport) int add(int a, int b)
    add = cast(
        pymm.MemoryGetProcAddress(handle, "add"),
        CFUNCTYPE(c_int, c_int, c_int)
    )

    # Use function exported from DLL
    assert add(1, 2) == 3

    # Free loaded DLL
    pymm.MemoryFreeLibrary(handle)

How to build and test

python setup.py build_ext -i test

How to run code check

python -m pip install flake8
python -m flake8 --show-source setup.py test.py

How to prepare README.rst

python setup.py md2rst

License

Mozilla Public License Version 2.0 (MPL2.0)

See also license of MemoryModule.

Note: PyMemoryModule also distributes a few lines of MIT licensed codes taken from py3c project.

Project details


Download files

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

Files for pymemorymodule, version 0.0.8
Filename, size File type Python version Upload date Hashes
Filename, size pymemorymodule-0.0.8-cp26-cp26m-win32.whl (11.2 kB) File type Wheel Python version 2.6 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp26-cp26m-win_amd64.whl (11.9 kB) File type Wheel Python version 2.6 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp27-cp27m-win32.whl (10.9 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp27-cp27m-win_amd64.whl (11.7 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp33-cp33m-win32.whl (10.8 kB) File type Wheel Python version 3.3 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp33-cp33m-win_amd64.whl (11.6 kB) File type Wheel Python version 3.3 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp34-cp34m-win32.whl (10.8 kB) File type Wheel Python version 3.4 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp34-cp34m-win_amd64.whl (11.6 kB) File type Wheel Python version 3.4 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp35-cp35m-win32.whl (11.3 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8-cp35-cp35m-win_amd64.whl (12.7 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size pymemorymodule-0.0.8.tar.gz (13.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page