Discussion:
error: reference to 'group' is ambiguous
(too old to reply)
Jeffrey Ratcliffe
2011-10-14 06:18:22 UTC
Permalink
I'm getting this error wrapping a C++ library:

Group.c: In function 'void XS_Foo__Group_new(PerlInterpreter*, CV*)':
Group.c:84: error: reference to 'group' is ambiguous
/usr/include/grp.h:44: error: candidates are: struct group
group.h:41: error: class foo::group

/usr/include/grp.h is pulled in perl.h, so obviously compiling with
-nostdlib is no possible.

If I try to make the type unambiguous by specifying foo::group in the
.xs, then I get typemap problems, which get worse if I include foo::
in group in the typemap as well.

Any suggestions?

Thanks for any help.

Regards

Jeff
Steffen Mueller
2011-10-14 06:40:52 UTC
Permalink
Post by Jeffrey Ratcliffe
Group.c:84: error: reference to 'group' is ambiguous
/usr/include/grp.h:44: error: candidates are: struct group
group.h:41: error: class foo::group
/usr/include/grp.h is pulled in perl.h, so obviously compiling with
-nostdlib is no possible.
If I try to make the type unambiguous by specifying foo::group in the
in group in the typemap as well.
Any suggestions?
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.

Source repository at https://github.com/tsee/Math-Clipper

Best regards,
Steffen
Jeffrey Ratcliffe
2011-10-17 18:57:05 UTC
Permalink
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
Steffen Mueller
2011-10-20 06:48:05 UTC
Permalink
Post by Jeffrey Ratcliffe
#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?
Have you seen the --hiertype option of xsubpp? I have a hunch it's
related. Train arriving, though, can't check now.

--Steffen
Jeffrey Ratcliffe
2012-01-08 09:54:08 UTC
Permalink
Have you seen the --hiertype option of xsubpp? I have a hunch it's related.
Train arriving, though, can't check now.
It was. Thanks for the hint.

Jeff

Loading...