FAQ
I am trying to learn how to make Python extensions for a cross platform
project I'm thinking about. Basically the CPU intensive stuff will be
in C or C++ and the GUI will be done with wxWindows in python. I will
need to build python extensions for this.

Attached to this email is my version of the "spam" sample code that you
find on the python website. The instructions for compiling on *Linux*
are in a comment at the end. This procedure works fine and I am able to
use the extension. On Windows (NT 4.0 sp6) I have tried to build this
extension using the version of gcc and ld that comes with cygwin. The
only change is that --shared is replaced with -c (--shared does not seem
to work on Windows) and the .so extension is replaced with .dll.

Even on Windows the extension builds and links just fine. I invoke
python just the way the comments show (the LD_LIBRARY_PATH seems to be
necessary on both Linux and Windows). When I try to do 'import spam' in
python I get an error that mentions dlopen and has a message like
"Windows error 32??????????" (i.e. very big number). I wish I had the
full error text but I didn't save it and can't get to it from home.
Just thought someone might know what this is and have a simple fix. I
will post again tomorrow with the full error text (but the "error
number" is so huge I suspect it's bogus).


--
You see, "state of the art" Microsoft Office applications sport a
nifty feature called "smart quotes." (Rule of thumb--every time
Microsoft uses the word "smart," be on the lookout for something
dumb). - John Walker, founder of Autodesk.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spammodule.c
Url: http://mail.python.org/pipermail/python-list/attachments/20020401/9812446c/attachment.pot

Search Discussions

  • Gerhard Häring at Apr 2, 2002 at 4:59 am

    * Gregory Propf [2002-04-01 20:39 -0500]:
    [trouble compiling extension modules]
    Solution: distutils

    A good starting point is Alex Martelli's recipe:

    http://groups.google.com/groups?q=group:comp.lang.python+alex+distutils+recipe&hl=en&selm=9v57kr02q3i%40enews4.newsguy.com&rnum=1

    Gerhard
    --
    This sig powered by Python!
    Au?entemperatur in M?nchen: 6.5 ?C Wind: 0.7 m/s
  • Richard Jones at Apr 2, 2002 at 4:07 am

    On Tue, 2 Apr 2002 14:59, you wrote:
    * Gregory Propf [2002-04-01 20:39 -0500]:
    [trouble compiling extension modules]
    Solution: distutils

    A good starting point is Alex Martelli's recipe:

    http://groups.google.com/groups?q=group:comp.lang.python+alex+distutils+rec
    ipe&hl=en&selm=9v57kr02q3i%40enews4.newsguy.com&rnum=1
    Note that there's optional bits in that URL. All you actually need is the
    message id:

    http://groups.google.com/groups?selm=9v57kr02q3i%40enews4.newsguy.com


    Richard
  • Gerhard Häring at Apr 2, 2002 at 5:08 am

    * Gregory Propf [2002-04-01 20:39 -0500]:
    [...] the GUI will be done with wxWindows in python. I will need to
    build python extensions for this.
    I have tried to build this extension using the version of gcc and ld
    that comes with cygwin.
    You don't really want to use Cygwin as target on Windows, do you? It's
    perfectly possible to use Mingw's or Cygwin's gcc (or even the free
    Borland compiler) to compile Python extensions for *native* win32
    Python. For native win32 Python, there's a wxPython installer. I just
    wanted to warn you that building wxPython for Cygwin could be quite
    tricky. And running wxPython over wxGTK over GTK over the Cygwin X
    server over the Windows sounds pretty pointless ;-)

    I already recommended distutils. If you want to use the Cygwin or Mingw
    compiler to compile extensions for native win32 Python, the build
    command using disutils is

    python setup.py --compiler=mingw32

    Just for kicks, you can build an Windows installer for your module with:

    python setup.py bdist_wininst

    or a RPM installer with:

    python setup.py bdist_rpm

    Enough advertising distutils for today :-)

    Gerhard
    --
    This sig powered by Python!
    Au?entemperatur in M?nchen: 6.2 ?C Wind: 0.9 m/s

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedApr 2, '02 at 1:39a
activeApr 2, '02 at 5:08a
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase