[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-distutils-sig
Subject:    [Distutils] Extending Python under Cygwin
From:       jason () tishler ! net (Jason Tishler)
Date:       2003-08-26 10:25:11
Message-ID: 20030826142734.GA1044 () tishler ! net
[Download RAW message or body]

Oleksandr,

On Tue, Aug 26, 2003 at 08:47:42AM -0500, Oleksandr wrote:
> Would you be so kind to help me?

With the attached patch (first attachment), your example can be built as
follows:

    $ gcc -shared -I /usr/include/python2.3 -o hello.dll hello.c -L \
/usr/lib/python2.3/config -lpython2.3

But, why not use Distutils which will do the "heavy lifting" for you?
See the attached setup.py (second attachment).  Using this script, your
example can be built as follows:

    $ python setup.py build
    running build
    running build_ext
    building 'hello' extension
    creating build
    creating build/temp.cygwin-1.5.2-i686-2.3
    gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes \
-I/usr/include/python2.3 -c hello.c -o build/temp.cygwin-1.5.2-i686-2.3/hello.o  \
creating build/lib.cygwin-1.5.2-i686-2.3  gcc -shared -Wl,--enable-auto-image-base \
build/temp.cygwin-1.5.2-i686-2.3/hello.o -L/usr/lib/python2.3/config -lpython2.3 -o \
build/lib.cygwin-1.5.2-i686-2.3/hello.dll

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
--- hello.c.orig	2003-08-26 10:02:15.188960000 -0400
+++ hello.c	2003-08-26 10:19:26.141396800 -0400
@@ -1,4 +1,4 @@
-#include </usr/include/python2.3/Python.h>
+#include <Python.h>
 #include <string.h>
 
 /* module functions */
@@ -22,7 +22,8 @@ static struct PyMethodDef hello_methods[
 };
 
 /* module initializer */
-void inithello()                       /* called on first import */
+PyMODINIT_FUNC
+inithello(void)                        /* called on first import */
 {                                      /* name matters if loaded dynamically */
     (void) Py_InitModule("hello", hello_methods);   /* mod name, table ptr */
 }
-------------- next part --------------
from distutils.core import setup, Extension

setup(
    name = 'hello',
    version = '1.0',
    ext_modules = [
        Extension(
            'hello',
            ['hello.c'])])


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic