help - Create dll

Bill Bell bill-bell at bill-bell.hamilton.on.ca
Wed Nov 7 08:10:48 EST 2001


"Glauco Silva" <glauco.silva at iti.gov.br>
> How can i create a dll file ( C dynamic library) from windows to be
> imported by python.

You have a few options:

1. My favourite: use MS VC to create the DLL as an in-process COM 
server with the default dual interfaces. This is not as difficult as it 
might sound: in particular, if your app needs to pass strings then 
look for posted articles about processing BSTR objects. Means for 
working with COM objects are discussed in the help files that come 
with the Activestate.com distribution of Python. Better still, buy 
"Python Programming on Win32" from O'Reilly.

2. Build your DLL as you normally would and use Sam Rushing's 
interfacing code for using DLL's (www.nightmare.com). As useful as 
this approach is for passing simple values back and forth it's 
somewhat difficult to learn as a consequence of the paucity of 
documentation.

3. Build your DLL as you normally would and use SWIG. Well 
documented, beautiful system that is heavily used by many who 
create libraries for use from Python. A lot to learn, though, if you're 
new to this area of programming.

Good luck!

Bill
"It is the time that you have wasted for your rose that makes your rose so important."--St-Exupery




More information about the Python-list mailing list