Newbie: SWIG or SIP?

  • Thread starter Brent W. Hughes
  • Start date
B

Brent W. Hughes

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
 
L

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
 
P

Peter Hansen

Larry said:
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
 
P

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top