Hello! I sent this already.
Perhaps it could be considered now. Kind regards, Hannah. ----- Forwarded message from Hannah Schroeter <[EMAIL PROTECTED]> ----- From: Hannah Schroeter <[EMAIL PROTECTED]> To: [email protected] Date: Tue, 10 Apr 2007 16:55:12 +0200 Subject: Issue with swig-1.3.24p4 and perl5 with C++ Hello! I wrote this to Kevin Lo, the maintainer of the swig port. He wrote back that I should mail this to [EMAIL PROTECTED] So here I do it, even if a bit late. Please note that I'm present only up to Tuesday, then I'll be (mostly) off the net for at least 6 weeks. Kind regards, Hannah. ----- Forwarded message from Hannah Schroeter <[EMAIL PROTECTED]> ----- From: Hannah Schroeter <[EMAIL PROTECTED]> To: Kevin Lo <[EMAIL PROTECTED]> Date: Wed, 7 Mar 2007 19:33:21 +0100 Subject: Issue with swig-1.3.24p4 and perl5 with C++ Hello! If I use swig with perl target with *C++* code, swig generates code that produces compile errors. This is caused by w-swig-1.3.24/SWIG-1.3.24/Lib/perl5/perlrun.swg, line 377: typedef XS(SwigPerlWrapper); XS, in turn, is defined in XSUB.h (/usr/libdata/perl5/i386-openbsd/5.8.8/CORE), around line 98. In C++, the above typedef expands to typedef extern "C" void SwigPerlWrapper(pTHX_ CV* cv); ^^^^^^^^^^ (in plain C, the expansion doesn't have extern "C" and compilation will succeed.) I think, a *good* fix would be perl providing another #define usable for typedef, like #define XSTYPEDEF(name) or something like that, and swig using that. Without changing perl, however, I did it by adding a small patch (see below) and bumping the package name of swig. Hope that's a usable report for you. If not, ask on. Kind regards, Hannah. patches/patch-Lib_perl5_perlrun_swg ----------------------------------------------------- $OpenBSD$ ``extern "C"'' comes in the way when wrapping C++ stuff --- Lib/perl5/perlrun.swg.orig Wed Mar 7 19:00:49 2007 +++ Lib/perl5/perlrun.swg Wed Mar 7 19:00:21 2007 @@ -374,7 +374,11 @@ SWIG_Perl_SetErrorf(const char *fmt, ... /* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */ +#ifdef __cplusplus +typedef void SwigPerlWrapper(pTHX_ CV* cv); +#else typedef XS(SwigPerlWrapper); +#endif typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ ------------------------------------------------------- ----- End forwarded message ----- ----- End forwarded message -----
