Accessing dll

Benjamin Kaplan benjamin.kaplan at case.edu
Thu Sep 6 11:26:23 EDT 2012


On Sep 6, 2012 8:15 AM, "Helpful person" <rrllff at yahoo.com> wrote:
>
> I am a complete novice to Python.  I wish to access a dll that has
> been written to be compatible with C and VB6.  I have been told that
> after running Python I should enter  "from ctypes import *" which
> allows Python to recognize the dll structure.  I have placed the dll
> into my active directory (if that's the correct word, one on my path)
> for simplification.
>
> I tried:   "import name.dll" but this just gave me an error telling me
> that there was no such module.
>
> Can someone please help?
>
> Richard
> --

Two things:

1) you would never use import name.dll, just like you don't use "import
math.py" you would just import name. But that only works for Python
libraries, which brings us to number 2

2) importing ctypes doesn't work any magic. Your c library is still a c
library, not a python library. Ctypes provides functions to let you load a
dll and makes calls to it, but you can't interact with the dll like python
code. Doing that takes a lot more work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120906/899460b3/attachment.html>


More information about the Python-list mailing list