C DLL loads in C++ program, not in python Ctypes

后端 未结 1 1614
时光取名叫无心
时光取名叫无心 2020-11-28 17:05

Question regarding python/ctypes and dll loading.

I have created a C Dll (extern C declarations) using VSExpress 2010. I can load and execute this dll with a CPP t

相关标签:
1条回答
  • 2020-11-28 17:13

    Use Sysinternals Process Monitor. Configure it to monitor the python.exe process for CreateFile operations:

    Process Monitor Filter dialog

    Then run your script. In the example below, I ran:

    >>> from ctypes import *
    >>> CDLL('x')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "D:\dev\Python33x64\lib\ctypes\__init__.py", line 353, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] The specified module could not be found
    

    x.dll does not exist, with the following result near the bottom of the trace, but note that any missing dependent DLL would show up similarly:

    Process Monitor trace

    0 讨论(0)
提交回复
热议问题