// static void PerlPower(int a, int b) static void callback() { dSP; /* initialize stack pointer */ ENTER; /* everything created after here */ SAVETMPS; /* ...is a temporary variable. */ PUSHMARK(SP); /* remember the stack pointer */ XPUSHs(sv_2mortal(newSViv(a))); /* push the base onto the stack */ XPUSHs(sv_2mortal(newSViv(b))); /* push the exponent onto stack */ PUTBACK; /* make local stack pointer global */ // call_pv("expo", G_SCALAR|G_DISCARD|G_NOARGS); /* call the function */ call_pv("p_callback", G_DISCARD|G_NOARGS); SPAGAIN; /* refresh stack pointer */ /* pop the return value from stack */ // printf ("%d to the %dth power is %d.\n", a, b, POPi); PUTBACK; FREETMPS; /* free that return value */ LEAVE; /* ...and the XPUSHed "mortal" args.*/ }