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 ctypes
import pymemorymodule as pymm

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 = ctypes.cast(
        pymm.MemoryGetProcAddress(handle, "add"),
        ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.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 -r requirements-test.txt
python -m flake8 --show-source setup.py test.py

How to prepare README.rst

python setup.py md2rst

MemoryModule

https://github.com/fancycode/MemoryModule

License

Mozilla Public License Version 2.0 (MPL2.0)

See also license of MemoryModule: https://github.com/fancycode/MemoryModule/blob/master/LICENSE.txt

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

pymemorymodule-0.0.6.tar.gz (13.4 kB view hashes)

Uploaded Source

Built Distributions

pymemorymodule-0.0.6-cp35-cp35m-win_amd64.whl (12.6 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

pymemorymodule-0.0.6-cp35-cp35m-win32.whl (11.1 kB view hashes)

Uploaded CPython 3.5m Windows x86

pymemorymodule-0.0.6-cp34-cp34m-win_amd64.whl (11.5 kB view hashes)

Uploaded CPython 3.4m Windows x86-64

pymemorymodule-0.0.6-cp34-cp34m-win32.whl (10.7 kB view hashes)

Uploaded CPython 3.4m Windows x86

pymemorymodule-0.0.6-cp33-cp33m-win_amd64.whl (11.5 kB view hashes)

Uploaded CPython 3.3m Windows x86-64

pymemorymodule-0.0.6-cp33-cp33m-win32.whl (10.7 kB view hashes)

Uploaded CPython 3.3m Windows x86

pymemorymodule-0.0.6-cp27-cp27m-win_amd64.whl (11.5 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

pymemorymodule-0.0.6-cp27-cp27m-win32.whl (10.8 kB view hashes)

Uploaded CPython 2.7m Windows x86

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