Re: error: reference to 'group' is ambiguous

[email protected] (Jeffrey Ratcliffe)
Newsgroups perl.xs
Message-ID <CACg2wbwj9uMdF=AY=ds_BUDmRoL+a7R+LFYamZh==Ets9mbabA@mail.gmail.com>
On 14 October 2011 08:40, Steffen Mueller <[email protected]> wrote:
> You can get this to work with typemaps. Have a look at how Mike Sheldrake
> solved this same problem (different symbol; Polygon on win32) for
> Math::Clipper. Should have been a few weeks/months ago.

Thanks for the help.

I wrote a typemap, which works, but only if I help xsubpp. I have the
following xs:

foo::group *
foo::group::new()
   CODE:
       RETVAL = new foo::group;
   OUTPUT:
       RETVAL

which xsubpp converts to:

XS(XS_Foo__Group_new)
{
#ifdef dVAR
   dVAR; dXSARGS;
#else
   dXSARGS;
#endif
   if (items != 1)
      croak_xs_usage(cv,  "CLASS");
   {
       char *  CLASS = (char *)SvPV_nolen(ST(0));
       foo__group *    RETVAL;
#line 16 "Group.xs"
       RETVAL = new foo::group;
#line 88 "Group.c"
       ST(0) = sv_newmortal();
       sv_setref_pv(ST(0), "Foo::Group", (void*)RETVAL);
   }
   XSRETURN(1);
}

which g++ doesn't like:

Group.c: In function 'void XS_Foo__Group_new(PerlInterpreter*, CV*)':
Group.c:84: error: 'foo__group' was not declared in this scope
Group.c:84: error: 'RETVAL' was not declared in this scope

If I

#define foo__group foo::group

then g++ is happy and everything works, but this strikes me as an evil hack.

Is there a better way?

Regards

Jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.