>________________________________
> From: Shweta Kaushik <k-shw...@hcl.com>
>To: "tutor@python.org" <tutor@python.org> 
>Sent: Wednesday, March 5, 2014 1:49 PM
>Subject: [Tutor] reg: How to import dll in python

>import ctypes
>From ctypes import *
>testDll = cdll.LoadLibrary("D:\Python Test Codes\DLL_Test\Addition.dll")
>test1 = ctypes.WINFUNCTYPE(None)
>test2 = test1 (("add", testDll))
> 
>Error Displayed
>Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>AttributeError: function 'add' not found

perhaps:

from ctypes import *
cppAdd = cdll.LoadLibrary(r"D:\Python Test Codes\DLL_Test\Addition.dll") # also 
note the r'

add = cppAdd.add
add.argtypes = [c_double, c_double]
add(1.0, 2.0)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to