How to point python on dll which should be link against imported extension python module at runtime?

43 Views Asked by At

I have an extension python module built with cmake. Module requires third party libutil.dll which linkes against it at runtime. Both module and libutil.dll package into wheel.

Are there some ways to help python find libutil.dll for module through setup.py config? Module and .dll located in the same folder in package.

I investigated some ways but all of them were rejected:

  1. Add a path to dll in PATH variable or some else environment variables;
  2. Launch python from directory where dll stored

setup.py has next content:

from setuptools import setup

setup(
     name ='my_ext_module',
     version = '0.0.1',
     classifiers = ["Programming Language :: Python :: 3"],
     packages = ['my_ext_module'],
     package_dir = {'my_ext_module' : 'src/module_dir'},
     package_data = {'' : ['*']},
     python_requires = ">=3.5"
)

The project has next structure:

setup.py
src
|---module_dir
    |---__init__.py
    |---ext_module.pyd
    |---libutil.dll
0

There are 0 best solutions below