from ctypes import *
import numpy as np
add_np = cdll.LoadLibrary("C:\\Users\\Owner\\Desktop\\Forpython\\add_np\\add_np\\add_np\\Debug\\add_np.dll")
add_np.add_array.argtypes = [
np.ctypeslib.ndpointer(dtype=np.float64),#a
np.ctypeslib.ndpointer(dtype=np.float64),#b
POINTER(c_int64),] #N
add_np.add_array_.restype = c_void_p #b
a = np.arange(0.,10.,dtype=np.float64) # 0,1,2,3,4,5,..,9
b = a*2 # 0,2,4,6,8,...,18
N = byref(c_int64(b.N))
add_np.add_array_(byref(a),byref(b),byref(N))
print b # [ 0 3 6 9 12 .. 27 ]
Error:
Traceback (most recent call last):
File "C:\Users\Owner\Desktop\Forpython\add_np\add_np.py", line 11, in <module>
POINTER(c_int64),] #N
File "C:\Python27\lib\ctypes\__init__.py", line 375, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 380, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'add_array' not found
Sorry and thanks!!!