Creating C modules for Python under Cygwin

Alex Martelli aleax at aleax.it
Mon May 6 10:53:09 EDT 2002


Martin v. Löwis wrote:
        ...
>>     $ dlltool --export-all --output-def python2.3.def python.exe
>>     $ dlltool --dllname python.exe --def python2.3.def --output-lib
>>     libpython2.3.dll.a
>> 
>>     $ make # [2]
> [...]
>>     [2] make succeeds this time because we are linking against an import
>>         library now.
> 
> 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.  I'd like to have a look at the .def file
this produces (it SHOULD say something like "LIBRARY python.exe" if it
follows the same rules as other Windows .def files).  Now, the question
becomes, how does Cygwin's loader try to fix things at .so loadtime?  It
is quite possible that it's doing a LoadLibrary and _that_ wouldn't work
(or at least "might not work") on python.exe.  GetModule OTOH _should_
work (since the .exe is "already loaded"...).  I _am_ getting rusty fast
at this low-level Windows stuff (just a few happy months back on Linux
and OpenBSD, and years of Windows stuff are rapidly going away...:-).


Alex




More information about the Python-list mailing list