This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How to make an extension of Python


Hello Jason

|See attached for my patch.  The following is the procedure to apply and
|build Python with it:
|
|    $ tar -xvzf Python-2.0.tar.gz
|    $ gunzip CygwinPython-2.0-full.patch.gz  # ***
|    $ cd Python-2.0
|    $ patch -p1 <../CygwinPython-2.0-full.patch  # ***
|    $ configure --with-threads=no --with-libm= --with-suffix=.exe 2>&1 |
tee configure.out
|    $ make 2>&1 | tee make.out
|    $ make install 2>&1 | tee make-install.out
|
|Note that only the steps marked with "# ***" above are different from
|the normal build procedure.
|
|To test out shared extensions, try the following:
|
|    $ cd Demo/extend
|    $ make_shared 2>&1 | tee make_shared.out
|    $ python
|    Python 2.0 (#1, Nov  1 2000, 08:51:39)
|    [GCC 2.95.2 19991024 (release-2)] on cygwin_nt-4.01
|    Type "copyright", "credits" or "license" for more information.
|    >>> import xx
|    >>> dir(xx)
|    ['__doc__', '__file__', '__name__', 'bug', 'error', 'foo', 'new',
'roj']
|    >>> xx.foo(2, 3)
|    5
|
|Please let me know you make out.  So far, only one other has tried my
|patch and I'm looking for any feedback -- both good and bad.

Wonderful !!!
This method is completely successful in my enviroment.

I have tried another usual build up of python2.0 without your patch and make
the extension of xx.dll by the make_shared method. Then I get an error
message when importing xx.dll: "Fatal Python error: Interpreter not
initialized".

May I have questions?

Question 1).
  Why does the usual build up of python end in a failure in making an
extension? What is your patch doing to correct the failure?

In another mail on "RE: How to make an extension of Python", Anthony
Tuininga tells
>I do not use anything from DLL helpers but rather simply use dllwrap
(version 0.2.4) with> the following command (NOT UNDER CYGWIN, btw); P.S.
Note that double dashes which were m>issing in your post (may be a typing
error but just in case.... :-)
>
>dllwrap --def cx_Oracle.def --output-lib libcx_Oracle.a --dllname
cx_Oracle.dll \
>        cx_Oracle.o -L/Tools/Library/Win32 -loci -lpython20

I tried the following written procedure that ended up in the error message:

dllwrap -o myEnviron.pyd -def myEnviron.def myEnviron.o -lpython2.0
"Importerror: dynamic modules does not define init
function ( initmyEnviron)".

I could create the extension of "environ.c" according to the following
instruction by Mingw32.

http://starship.python.net/crew/kernr/mingw32/Notes.html
Instructions for Python Extensions with GCC/mingw32 by Robert Kern.

>dllwrap --dllname foo.pyd --driver-name gcc --def foo.def -o foo.pyd \
>foomodule.o -s --entry _DllMain@12 --target=i386-mingw32 -L<py-lib-dir> \
>-lpython15
However, the same "environ.c" could not be a successful dll binary in
Cygwin.

Question 2)
Why did the simple dllwrap smoetimes successfully create an extension
and another time unsuccessfully in Cygwin?

Than you very much.
----------=========---------
Mitsuo Igarashi
mitsu5@ruby.famille.ne.jp





--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]