[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules _sre.c

Jason Tishler Jason.Tishler@dothill.com
Wed, 28 Feb 2001 14:41:37 -0500


--Hj+UoetjUl0PiTw5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Fredrik,

On Wed, Feb 28, 2001 at 06:36:09PM +0100, Fredrik Lundh wrote:
> tim indirectly wrote:
> 
> > *** _sre.c 2001/01/16 07:37:30 2.52
> > --- _sre.c 2001/02/28 16:44:18 2.53
> [snip]
> 
> after this change, the separate makefile I use to build _sre
> on Windows no longer works (init_sre isn't exported).
> 
> I don't really understand the code in config.h, but I've tried
> defining USE_DL_EXPORT (gives linking problems) and
> USE_DL_IMPORT (macro redefinition).

USE_DL_EXPORT is to be defined only when building the Win32 (and Cygwin)
DLL core not when building extensions.  When building Win32 Python,
USE_DL_IMPORT is implicitly defined in PC/config.h when USE_DL_EXPORT is
not.  Explicitly defining USE_DL_IMPORT will cause the macro redefinition
warning indicated above -- but no other ill or good effect.

Another way to solve your problem without using the "/export:init_sre"
link option is by patching PC/config.h with the attached.  When I was
converting Cygwin Python to use a DLL core instead of a static library
one, I wondered why the USE_DL_IMPORT case was missing the following:

    #define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
    
Anyway, sorry that I caused you some heartache.

Jason

P.S. If this patch is to be seriously considered, then the analogous
change should be done for the other Win32 compilers (e.g. Borland).

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--Hj+UoetjUl0PiTw5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="config.h.patch"

Index: config.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/PC/config.h,v
retrieving revision 1.49
diff -u -r1.49 config.h
--- config.h	2001/02/28 08:15:16	1.49
+++ config.h	2001/02/28 19:16:52
@@ -118,6 +118,7 @@
 #endif
 #ifdef USE_DL_IMPORT
 #define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
+#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
 #endif
 #ifdef USE_DL_EXPORT
 #define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE

--Hj+UoetjUl0PiTw5--