[Python-Dev] Is __declspec(dllexport) really needed on Windows?
Tim Peters
tim@zope.com
Thu, 18 Jul 2002 15:34:58 -0400
[Greg Ewing]
> Someone told me that Pyrex should be generating
> __declspec(dllexport) for the module init func.
> But someone else says this is only needed if
> you're importing a dll as a library,
1. What else could one do with a DLL? That is, in your view is
the "importing ... as a library" part not redundant?
2. Does Pyrex compile to DLLs (or PYDs) on Windows? I simply don't
know.
> and that it's not needed for Python extensions.
If an extension is compiled into a DLL/PYD, it must tell the linker which
symbols are to be exported. __declspec(dllexport) in the source is one way
to do that. Other possibilities include creating a .def file, or specifying
exported names on the linker's command line (like "/export:init_sre").
The best thing to do for Windows is ask that Windows users supply patches.
Or you could upgrade to Windows yourself <wink>.