Re: Newbie: SWIG or SIP?

2005-02-10 Thread Phil Thompson
 I have a third-party DLL and it's associated .h file.  The DLL was written
 in C.  I have neither the associated .c files nor the .obj files for the
 DLL.  Can I use SWIG or SIP to build something that will allow me to use
 the
 DLL with Python?  And what is that something, an .obj file, another DLL or
 what?

Yes, you can use either SWIG or SIP. C (as opposed to C++) support was
added with SIP v4. The something is another DLL, conventionally given a
.pyd extenstion.

Phil

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: SWIG or SIP?

2005-02-10 Thread suryaprakashg
Look at this , this might be more simple to use

http://starship.python.net/crew/theller/ctypes/



Phil Thompson wrote:
  I have a third-party DLL and it's associated .h file.  The DLL was
written
  in C.  I have neither the associated .c files nor the .obj files
for the
  DLL.  Can I use SWIG or SIP to build something that will allow me
to use
  the
  DLL with Python?  And what is that something, an .obj file, another
DLL or
  what?

 Yes, you can use either SWIG or SIP. C (as opposed to C++) support
was
 added with SIP v4. The something is another DLL, conventionally given
a
 .pyd extenstion.
 
 Phil

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: SWIG or SIP?

2005-02-10 Thread Grant Edwards
On 2005-02-10, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Phil Thompson wrote:
 I have a third-party DLL and it's associated .h file.  The DLL
 was written in C.  I have neither the associated .c files nor
 the .obj files for the DLL.  Can I use SWIG or SIP to build
 something that will allow me to use the DLL with Python?  And
 what is that something, an .obj file, another DLL or what?

 Yes, you can use either SWIG or SIP. C (as opposed to C++)
 support was added with SIP v4. The something is another DLL,
 conventionally given a .pyd extenstion.

 Look at this , this might be more simple to use

 http://starship.python.net/crew/theller/ctypes/

ctypes completely rocks.  I'm guessing it's a little more
overhead than using a swigified DLL, but it's dead-easy to use
and doesn't require a C or C++ compiler.  For the stuff I do, a
bit of extra overhead when calling DLL's is completely
negligible.

-- 
Grant Edwards   grante Yow!  By MEER biz doo
  at   SCHOIN...
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: SWIG or SIP?

2005-02-09 Thread Larry Bates
You can call the .DLL file by using a solution
I wrote (and donated) some time ago.  It is located here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847
You will need calldll.pyd available here:
http://www.nightmare.com/software.html
I've used this solution a LOT and it has worked with .DLLs
from many different manufacturers.  Tricky part is having a
full definition of API to dll (e.g. argument types) and using
struct module to communicate between Python and the .DLL.
Larry Bates

Brent W. Hughes wrote:
I have a third-party DLL and it's associated .h file.  The DLL was written 
in C.  I have neither the associated .c files nor the .obj files for the 
DLL.  Can I use SWIG or SIP to build something that will allow me to use the 
DLL with Python?  And what is that something, an .obj file, another DLL or 
what?

Brent

--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: SWIG or SIP?

2005-02-09 Thread Caleb Hattingh
Brent
Google python ctypes.  ctypes is cool :)
keep well
Caleb

On Wed, 9 Feb 2005 13:44:44 -0700, Brent W. Hughes  
[EMAIL PROTECTED] wrote:

I have a third-party DLL and it's associated .h file.  The DLL was  
written
in C.  I have neither the associated .c files nor the .obj files for the
DLL.  Can I use SWIG or SIP to build something that will allow me to use  
the
DLL with Python?  And what is that something, an .obj file, another DLL  
or
what?

Brent

--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: SWIG or SIP?

2005-02-09 Thread Peter Hansen
Larry Bates wrote:
You can call the .DLL file by using a solution
I wrote (and donated) some time ago.  It is located here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146847
You will need calldll.pyd available here:
http://www.nightmare.com/software.html
While calldll works for this (and I greatly appreciated having
it in the past), I'm pretty sure that for pretty much all
purposes ctypes is the preferred approach at this point.
If nothing else, it is actively maintained, while calldll is not.
I'm pretty sure ctypes is also easier to use.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list