From Perl XS code, how do I recursively call myself?

I have a sophisticated encoding function in Pure Perl that I convert to XS in the hope of improving performance.

The function that I am converting to XS requires a recursive call. I can see how to use call_sv [thanks to "man perlcall"] to call Pure Perl functions.

But what do I call myself (or any other XS function) from within XS?

(PS Efficiency is very desirable ...)

Can someone tell me? Or an example? P-p-p-please!

UPDATE: The first answer was absolutely correct. Calling to recursive pure C functions works very well.

+7
source share
1 answer

not to do. XS is the mechanism that provides the Perl interface for function C. Do not call the XS function from function C (for which you would use call_sv or the like); call function C from function XS.

Write your recursive function C and save it outside the XS code (until the line MODULE = or in a separate .c ). Call it from the thin shell of XS.

+9
source

All Articles