Hi again,

In the end I found some code in 'perldoc perlcall' that works with inline just fine - called from both perl and C - as many times as I want. It will do quite nicely.

The 'call_me_stupid' function now looks like this:

void call_me_stupid(int a, int b) {
     dSP ;

     ENTER ;
     SAVETMPS ;

     PUSHMARK(SP) ;
     XPUSHs(sv_2mortal(newSViv(a)));
     XPUSHs(sv_2mortal(newSViv(b)));
     PUTBACK ;

     call_pv("me_stupid", G_DISCARD);

     FREETMPS ;
     LEAVE ;

}

I believe that should replace the current example in the cookbook - which is obviously flawed. (Perhaps the name of the function could be changed to protect the innocent.)

Or is it just that the current Inline Stack macros don't quite cover the situation correctly when it comes to callbacks ?

Cheers,
Rob



Reply via email to