Re: SGML::Parser::OpenSP Win32 PPMs

* Randy Kobes wrote:
>==================================================================
>I got the following error:
>=================================================================
>	cl -TP -EHsc -ID:/unzipped/sp/ -c -nologo -Gf -W3
>-MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT
>-DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT
>-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD
>-DNDEBUG -O1 -DVERSION=\"0.02\"  -DXS_VERSION=\"0.02\"
>"-ID:\Perl\lib\CORE"  -DSP_MULTI_BYTE=1 OpenSP.c OpenSP.c
>
>C:\VStudio\VC98\include\math.h(514) : error C2894: templates
>cannot be declared to have 'C' linkage
>
>============================================================

Thanks. Hmm. http://www.nntp.perl.org/group/perl.cpan.testers/98294
points out a similar problem, and the article referenced from there
has http://perlmonks.com/index.pl?node_id=274055 which provides some
ideas, too. Hm, I think this is a bug in math.h, the line is

  template<class _Ty> inline

while in VC++ 7.1 it got replaced by

  extern "C++" {

  template<class _Ty> inline
  ...

Hmm, I would suspect (I am afraid I cannot test it, I don't have
sufficient free disc space to install VC++ 6.0...) that adding

  // woraround for broken math.h in VC++ 6.0
  #if defined(_MSC_VER) && _MSC_VER < 1300
  #include <math.h>
  #endif

prior to the extern "C" ... includes would work around this. If
I change my math.h to match yours in this regard I can reproduce
this problem and adding the include (without the _MSC_VER check)
solves it, so maybe you could apply the following patch and try
again?

...
Index: OpenSP.xs
===================================================================
RCS file: /cvsroot/spo/spo/OpenSP.xs,v
retrieving revision 1.14
diff -u -p -r1.14 OpenSP.xs
--- OpenSP.xs   14 Sep 2004 08:12:24 -0000      1.14
+++ OpenSP.xs   17 Sep 2004 09:32:27 -0000
@@ -4,6 +4,11 @@

 // todo: add THX stuff?

+// woraround for broken math.h in VC++ 6.0
+#if defined(_MSC_VER) && _MSC_VER < 1300
+#include <math.h>
+#endif
+
 extern "C"
 {
 #include "EXTERN.h"
...

It should solve at least the C2894 problem. Oh, and yes, the module is
not yet ready for a CPAN release, the typemap in particular needs some
attention...

Received on Friday, 17 September 2004 09:39:03 UTC