in reply to Calling an overload::Method

It seems to me the way round that at XS level is to use a varargs signature? (I've recently been battling PDL's overload methods)
char * op_stringify(left, ...) SV * left CODE: RETVAL = my_stringify(left); OUTPUT: RETVAL

Replies are listed 'Best First'.
Re^2: Calling an overload::Method
by hv (Prior) on Mar 24, 2022 at 12:30 UTC

    I didn't try that - if it works, then yes I guess that's an option. It is possible that it will limit portability, since varargs stuff has traditionally been tricky in that regard - but since you're not actually looking at the additional arguments (ie not calling va_start), maybe that won't be a problem.

    I've no idea what C that will translate to: I'm curious how it will decide to invoke the typemaps, since you have not declared what type the additional arguments are. In principle that might even make it slightly faster.

      There are no portability issues since Perl XS functions don't use va_start for either varargs or non-varargs XS. Please look in a .c file generated from a .xs :-)