On Sat, Dec 31, 2016 at 3:04 PM, Hugo van der Sanden via RT < perlbug-followup@perl.org> wrote: > On Wed, 28 Dec 2016 07:13:36 -0800, davem wrote: > > When foo,h contains this: > > > > #include <stdbool.h> > > void h2xs(bool b); > > > > then h2xs -x foo.h, via C::Scan, is generating an XS file that looks > > like: > > > > void > > h2xs(arg0) > > > > which is being converted into the C code > > > > XS_EUPXS(XS_Foo_h2xs); /* prototype to pass -Wmissing-prototypes */ > > XS_EUPXS(XS_Foo_h2xs) > > { > > dVAR; dXSARGS; > > if (items != 1) > > croak_xs_usage(cv, "arg0"); > > { > > > > h2xs(arg0); > > } > > XSRETURN_EMPTY; > > } > > > > The issues seem to be that > > > > 1) h2xs and/or C::Scan isn't including the variable type for arg0 in > > the > > generated XS; I assume that it should have output: > > > > void > > h2xs(bool arg0) > > I'm seeing it output this (which I believe is correct): > void > h2xs(b) > _Bool b > > > > > 2) that ExtUtils/xsubpp isn't seeing that as an error and is instead > > converting it onto invalid C code, by not including the line: > > > > bool arg0 = (bool)SvTRUE(ST(0)) > > For me, xsubpp is giving this: > > _Bool b; > > if (SvROK(ST(0)) && sv_derived_from(ST(0), "_Bool")) { > IV tmp = SvIV((SV*)SvRV(ST(0))); > b = INT2PTR(_Bool,tmp); > } > else [...] > > I haven't been able to reproduce the case of a missing '_Bool b' > declaration in Foo.xs, so I'm stuck on this for now. > > Hugo > It seems to assume _Bool is some kind of object type, for some reason, hence my previous suggestion for an explicit typemap. LeonThread Previous | Thread Next