Windows dll example?

Paul Moore gustav at morpheus.demon.co.uk
Mon Dec 16 17:22:25 EST 2002


Tim Peters <tim.one at comcast.net> writes:

> [Jive Dadson]
>> I need to make a Python extension using MS VC++, preferably using
>> a dll.  I've googled around and found lots of instructions on how
>> to do it, some apparently clearer than others.  But as a typical
>> lazy programmer, what I really want is a small to medium size
>> working VC++ project (.dsp) in a workspace (.dsw) that I can use
>> as an example.  There must be plenty around.  Can you think of a
>> good one that I can download from the net?
>
> Exactly what you're looking for can be found in the Python source
> distribution.

... on the other hand, if you're not constrained to using the MSVC IDE
or some other aspect of MSVC which mandates .dsp and .dsw files, you
can use distutils.

Look in the Python manuals to see how to make and build C
extensions. The instructions are generic, in that they don't refer
specifically to MSVC, but building using MSVC works out of the box.

As a sample, here's a small setup.py I wrote to build calldll (Sam
Rushing's interface to the Windows API).

#!/usr/bin/env python

from distutils.core import setup, Extension

setup (name = "calldll",
       version = "2001.05.20",
       description = "Dynamic calls",
       author = "Sam Rushing",
       ext_modules = [ Extension("calldll", ["calldllmodule.cpp"]) ]
   )

Paul
-- 
This signature intentionally left blank



More information about the Python-list mailing list