Python调用dll文件返回错误无法解决,,,大神帮忙啊! 100
我写了一个dll文件,想用Python调用里面的C程序,但是一直报错,网上查到的方法也解决不了,求助啊!importctypesfromctypesimport*dll=...
我写了一个dll文件,想用Python调用里面的C程序,但是一直报错,网上查到的方法也解决不了,求助啊!
import ctypes
from ctypes import *
dll = ctypes.WinDLL('C:/Python27/Lib/ctypes/Sum.dll')
----下面为报错:----
Traceback (most recent call last):
File "<pyshell#31>", line 1, in <module>
dll = ctypes.WinDLL('C:/Python27/Lib/ctypes/Sum.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126]
------------------------------------
-----------下面为dll文件代码:(dll文件名为Sum.dll)---------
extern "C"
{
int Sum(int *a, int N)
{
int *q = a + N , sum = 0 ;
for (int* p = a ; p < q ; ++p)
{
sum += *p ;
}
return sum ;
}
} 展开
import ctypes
from ctypes import *
dll = ctypes.WinDLL('C:/Python27/Lib/ctypes/Sum.dll')
----下面为报错:----
Traceback (most recent call last):
File "<pyshell#31>", line 1, in <module>
dll = ctypes.WinDLL('C:/Python27/Lib/ctypes/Sum.dll')
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126]
------------------------------------
-----------下面为dll文件代码:(dll文件名为Sum.dll)---------
extern "C"
{
int Sum(int *a, int N)
{
int *q = a + N , sum = 0 ;
for (int* p = a ; p < q ; ++p)
{
sum += *p ;
}
return sum ;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询