Creating C modules for Python under Cygwin

Jason Tishler jason at tishler.net
Mon May 6 12:59:22 EDT 2002


On Mon, May 06, 2002 at 02:53:09PM +0000, Alex Martelli wrote:
> Martin v. Löwis wrote:
> > I think this is what Alex had in mind.
> 
> Alex doesn't understand the details of Cygwin, and dlltool in particular, 
> well enough to be certain, but it sure looks something like what I was
> saying should be doable, yes.
> [snip]

OK, I got it to work.  My previous procedure was incorrect because it did
not get python.exe to export any symbols.  The new (still quick and dirty)
procedure is as follows:

    $ configure --disable-shared
    $ make python # [1]
    $ mkexp.sh    # [2]
    $ make        # [3]

Notes:

    [1] make will stop after python.exe is built but before the shared
        extensions are.
    [2] Rebuild python.exe to export all appropriate symbols.  The
        attached shell script, mkexp.sh, just blindly follows the
        procedure used by Cygwin PostgreSQL to export symbols from an
        executable.  I admit to not fully grokking this procedure (yet).
        Additionally, there may be better, more modern ways (i.e., gcc
        -shared) of accomplishing the same results.  I will investigate
        further.
    [3] Continue make to build the shared extensions.

A Cygwin Python with a static Python library built with the above
procedure successfully loads shared extensions and passes all regression
tests.

I intend to submit a patch to Python CVS with a clean version of the
above.  However my motivation would be greater, if I actually knew of
someone who is really interested in this functionality.  Is there anyone?

Thanks,
Jason

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkexp.sh
Type: application/x-sh
Size: 2429 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20020506/b7f7d71e/attachment.sh>


More information about the Python-list mailing list