develooper Front page | perl.perl5.porters | Postings from November 2003

[PATCH] Re: MinGW-3.1.0-1 _CRTIMP definition preempting win32.h's

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
November 2, 2003 06:04
Subject:
[PATCH] Re: MinGW-3.1.0-1 _CRTIMP definition preempting win32.h's
Message ID:
20031102150954.2da6c6f6.rgarciasuarez@free.fr
Abe Timmerman wrote:
> > > Recent perls are building for me on Windows 98 with the older
> > > MinGW-2.0.0-3, but with the new MinGW-3.1.0-1, _pioinfo,
> > > imported by win32.h is not being declared as dllimport
> > >
> > > This is due to the _CRTIMP definition in _mingw.h being pulled in
> > > before win32.h's definition, according to Danny Smith on the
> > > mingw-users list.
> > >
> > > See a discussion starting here:
> > > https://sourceforge.net/forum/message.php?msg_id=2253759
> > >
> > > With this workaround,
> > >
> > > greg@7106 ~
> > > $ diff perl-5.8.2-RC1/win32/win32.h perl-5.8.2-RC1/win32/win32.h~
> > > 505c505
> > > < extern __declspec(dllimport) ioinfo * __pioinfo[];
> > > ---
> > >
> > > > EXTERN_C _CRTIMP ioinfo* __pioinfo[];
> > >
> > > I was able to build perl-5.8.2-RC1 and perl-5.9.0 on Windows 98.
> >
> > Thanks for the report, but unfortunately I can't integrate it as-is,
> > to avoid breaking other environments. What are the C preprocessor
> > symbols that I can check to know whether one is using MinGW 3 or greater
> > (assuming your patch is needed for MinGW >= 3.0.0 ?)
> 
> 
> 	#if defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION>=3)

So a simple patch like this one should solve the problem. Does it look
good ? (sorry, I can't test it, no MinGW here)

Index: win32/win32.h
===================================================================
--- win32/win32.h	(revision 2678)
+++ win32/win32.h	(working copy)
@@ -465,7 +465,7 @@
 #ifdef PERL_CORE
 
 /* C doesn't like repeat struct definitions */
-#ifndef _CRTIMP
+#if !defined(_CRTIMP) || (defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION>=3))
 #define _CRTIMP __declspec(dllimport)
 #endif
 
End of Patch.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About