probs w/ building python extensions on free Microsoft.NET SDK

Greg Landrum gReGlAnDrUm at earthlink.net
Tue Aug 7 00:30:46 EDT 2001


"Shakeeb Alireza" <sa at bayt.net> wrote in message
news:280f26fb.0108061915.54ea1e98 at posting.google.com...
>
> However, I'm totally frustrated by the experience of creating
> extensions: nothing it seems is more unfriendly to newbies in the
> python world (at least in my experience) than information on embedding
> and extending python through c.
>

While I agree that the extending/embedding docs aren't necessarily as user
friendly as they could be, I would contend that they aren't really directed
at newbies.  Extending/embedding is an advanced topic.  This isn't to say
that you shouldn't be doing it, but you definitely should expect it to be
more challenging than using Python itself.

> I've tried unsuccessfully in the past to compile python extensions
> using cygwin, but failed for more than one reason or the other and
> then just gave up. Recently I downloaded Microsoft's freely available
> .NET SDK which contains the standard MS c/c++ compiler and libraries
> and I thought this would be an opportunity to try the python extension
> thing again.
>

You are making things a lot harder on yourself than they need to be.  You're
using a beta of a fragment of a build environment and then trying to apply
documentation which was written for people using the full environment.  If
you don't want to pay for your compiler, look into the Borland product,
which I know has been used to build python extensions.  I remember seeing at
least one how-to for this as well.

> Again, my main source of confusion was due to the documentation with
> its intermezzos, dearth of clear examples, and its essential
> assumption that the reader is already a proficient c coder and not a
> newbie (graduating to c extensions).

It's assuming that you are a newbie to writing extensions.  It certainly
isn't trying to teach you C.  Interlanguage stuff is always harder than
writing in a single language.  Probably the best first C project is
something other than writing an extension module.

> It further assumes you are using
> the gui of visual studio and not the compiler directly via command
> line.

This is partially true, and with a reason.  The standard build environment
under Windows is Visual Studio.  So the docs are written for the standard
env.

>
> (Please note that my knowledge of handling the compilation of c code
> is limited to tiny 'hello-world'-like programs.)
>

And that's a significant part of the problem here.

Python is easy, extension modules are not.

-greg





More information about the Python-list mailing list