in reply to [XS] Callbacks to perl
Ignore this! I was testing a different file to the one I was editing :(
I believe you can simplify that further to just this:
SV * _Adder(SV * a, SV * b) { dSP; I32 ax; PUSHMARK(SP); if( call_pv("Adder", G_SCALAR) != 1 ) croak("Big trouble\n"); SPAGAIN; return sv_2mortal( ST(0) ); }
This runs clean for me without leaks or warnings.
Although I did see the dreaded "Attempt to free uninitialized" on one occasion when I ^C'd it, but I haven't been able to reproduce it despite dozens of attempts. I can occasionally produce that error when I interrupt a pure perl script also.
As always with XS, some elements of that are pure cargo cult. I'm not sure that the PUSHMARK and SPAGAIN are actually doing anything at all, and I have no idea why I need to declare ax.
|
|---|