ctypes help

gianluca geonomica at gmail.com
Fri May 23 00:55:41 EDT 2008


On 23 Mag, 01:14, Larry Bates <larry.ba... at websafe.com`> wrote:
> gianluca wrote:
> > Hy,
> > I need help about use dll with ctypes. I've compiled my dll C library
> > and I copied it in c:\windows\system32. When I load it with
> > "myDLL=cdll.LoadLibrary(find_library("myDLL.dll"))" It seem all OK but
> > python don't see the dll function. with dir(myDLL) I've only this:
> > ['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__',
> > '__getattr__', '__getattribute__', '__getitem__', '__hash__',
> > '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
> > '__repr__', '__setattr__', '__str__', '__weakref__', '_handle',
> > '_name']
>
> > Could anybody help me
>
> > Thanks
>
> > Gianluca
>
> Since it isn't python, dir can'd do much introspection on the object to produce
> the type of output you desire.  You have to know the functions (methods) that
> you want to call in your dll and call them.
>
> -Larry Bates


Yes, I know it but when I load a function (a=myDLL.myFUNCT()) I've an
exception like this:

Traceback (most recent call last):
  File "<pyshell#18>", line 1, in <module>
    myDLL.myFUNCT()
  File "C:\Python25\lib\ctypes\__init__.py", line 353, in __getattr__
    func = self.__getitem__(name)
  File "C:\Python25\lib\ctypes\__init__.py", line 358, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'myFUNCT' not found

Thanks for help



More information about the Python-list mailing list