Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28638

Re: Accessing dll

Newsgroups comp.lang.python
Date 2012-09-06 13:27 -0700
References <0e642403-36e9-4945-9efb-4d074d7d0eb2@s5g2000vbj.googlegroups.com> <e9c1576d-e3ed-49cd-bc30-8e0d5d18405c@googlegroups.com>
Message-ID <f59d0c4f-5302-469f-b927-fa58661e4a32@googlegroups.com> (permalink)
Subject Re: Accessing dll
From Tim Williams <tjandacw@cox.net>

Show all headers | View raw


On Thursday, September 6, 2012 4:21:56 PM UTC-4, Tim Williams wrote:
> On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person 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
> 
> 
> 
> I'm new to using the ctypes module also, but what I did to find the library was I appended the location of the dll to my PATH like so: (this is Windows)
> 
> 
> 
> pth = os.environ['path'].split(';')
> 
> pth.append(os.path.join(os.environ['userprofile'],'My Documents','DLLs'))
> 
> os.environ['path'] = ';'.join(pth)

I should have also mentioned to look at LoadLibrary in the ctypes module. e.g. 

mylib=cdll.LoadLibrary('mylib.dll')

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-06 08:07 -0700
  Re: Accessing dll Jerry Hill <malaclypse2@gmail.com> - 2012-09-06 11:30 -0400
    Re: Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-06 08:41 -0700
    Re: Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-06 08:44 -0700
      Re: Accessing dll Chris Angelico <rosuav@gmail.com> - 2012-09-07 22:15 +1000
        Re: Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-07 10:27 -0700
          Re: Accessing dll Chris Angelico <rosuav@gmail.com> - 2012-09-08 21:21 +1000
    Re: Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-06 09:46 -0700
      Re: Accessing dll Jerry Hill <malaclypse2@gmail.com> - 2012-09-06 12:58 -0400
        Re: Accessing dll Helpful person <rrllff@yahoo.com> - 2012-09-06 10:10 -0700
      Re: Accessing dll MRAB <python@mrabarnett.plus.com> - 2012-09-06 18:17 +0100
  Re: Accessing dll Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-09-06 17:28 +0200
  Re: Accessing dll Tim Williams <tjandacw@cox.net> - 2012-09-06 13:21 -0700
    Re: Accessing dll Tim Williams <tjandacw@cox.net> - 2012-09-06 13:27 -0700

csiph-web