Building Python extensions from sources on Windows

Discussion in 'Python' started by TPJ, Mar 25, 2006.

  1. TPJ

    TPJ Guest

    Hello, I have another, probably stupid, question.

    I'm working on some Python project, and I use some extensions written
    in C. I do all the development on my GNU/Linux box, so my setup.py
    script works just as it's supposed to work on a GNU/Linux system. But
    in the nearest future I'll have to make an executable program for
    Windows.

    I know, that there are some useful tools to make executables from
    Python programs for Windows (Py2Exe, PyInstaller - that's what I have
    heard about), but, as far as I understand the subject, I'll need the
    extensions modules (dll files? on my GNU/Linux system I always get some
    so files - shared libraries) in the compiled form in order to make any
    executable program.

    In the Python standard documentation I have read, that:

    "(...) Since the metadata is taken from the setup script, creating
    Windows installers is usually as easy as running:

    python setup.py bdist_wininst
    (...)

    If you have a non-pure distribution, the extensions can only be created
    on a Windows platform, and will be Python version dependent. (...)"

    And that's the problem: I understand the fact, that in order to build a
    non-pure distrubution, all the C sources have to be compiled (to dll
    libraries?). But there's the problem: I don't know which one compiler
    should I use. Do I have to use the same compiler, that the Python has
    been compiled with? If so, which one of the Windows compilers has been
    used to compile Python?

    Or perhaps could I use an another compiler? Which one, then?

    I have no idea what to do. I haven't done anything on Windows for so
    long...
     
    TPJ, Mar 25, 2006
    #1
    1. Advertising

  2. TPJ wrote:
    > And that's the problem: I understand the fact, that in order to build a
    > non-pure distrubution, all the C sources have to be compiled (to dll
    > libraries?). But there's the problem: I don't know which one compiler
    > should I use. Do I have to use the same compiler, that the Python has
    > been compiled with? If so, which one of the Windows compilers has been
    > used to compile Python?
    >
    > Or perhaps could I use an another compiler? Which one, then?


    You should use the same compiler; for Python 2.4, that was Visual Studio
    ..NET 2003. More specifically, you need to use the same version of the
    C library - the compiler does not matter that much. The C library is
    msvcr71.dll.

    It is possible to build extensions with other compilers as well, e.g.
    GNU mingw32.

    If you don't VS 2003, but want to use that compiler, take a look at

    http://www.vrplumber.com/programming/mstoolkit/

    Regards,
    Martin
     
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=, Mar 25, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William
    Replies:
    2
    Views:
    367
  2. Antoine Maillard
    Replies:
    1
    Views:
    345
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Aug 2, 2004
  3. JW
    Replies:
    6
    Views:
    481
    Sybren Stuvel
    Oct 17, 2006
  4. Harold Hausman
    Replies:
    3
    Views:
    208
    Jano Svitok
    Apr 27, 2007
  5. Mark H Harris
    Replies:
    6
    Views:
    128
    Terry Reedy
    Jun 13, 2014
Loading...

Share This Page