
On Thu, Jan 02, 2003 at 11:29:33PM +0100, Martin v. Löwis wrote:
Jason Tishler <jason@tishler.net> writes:
I feel this is the best approach because modules should build under Cygwin without the standard Cygwin style patch that I have been submitting for years. Do others concur? If so, then I will begin to clean up the "mess" that I have created.
This is what I thought a reasonable operating system and compiler should do by default, without even asking.
Well then, I guess Windows, Cygwin, and/or gcc are not "reasonable." :,)
I certainly agree that it is desirable that you can put function pointers into static structures, so if it takes additional compiler flags to make it so, then use those flags.
Back when I first submitted my Cygwin Python DLL and Shared Extension Patch: http://sf.net/tracker/?group_id=5470&atid=305470&func=detail&aid=402409 there were no such options. Since then Cygwin ld has been significantly enhanced to support the following options: --enable-auto-import (currently defaults to enabled) --enable-runtime-pseudo-reloc (currently defaults to disabled) See the Cygwin ld man page for more details, if interested. Since Python's source already had the __declspec(dllexport) and __declspec(dllimport) indicators for Win32, I never pursued leveraging off of the new functionality. That is, until Tim informed me that MSVC could deal with __declspec(dllimport) function pointers as static initializers. I had erroneously concluded from the following: http://python.org/doc/FAQ.html#3.24 that it couldn't.
I'm unclear why you have to *omit* the declspec, though, to make it work - I thought that __declspec(dllimport) is precisely the magic incantation that makes the compiler emit the necessary thunks.
Before --enable-auto-import was added to Cygwin ld, both __declspec(dllexport) and __declspec(dllimport) were necessary for successful linking. After --enable-auto-import was added, the linker could automatically import functions as long as the function was exported by any of the various methods (e.g., __declspec(dllexport), --export-all-symbols, .def file, etc.). Since the __declspec(dllimport) indicators are causing compilation problems with shared extension modules and they are no longer needed, it seems that the simplest (and best) solution is to just remove them. 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