Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created February 20, 2014 22:06
Show Gist options
  • Select an option

  • Save tobyink/9124283 to your computer and use it in GitHub Desktop.

Select an option

Save tobyink/9124283 to your computer and use it in GitHub Desktop.
dSP;
int count;
SV *ret;
bool can;
SV *method_name = newSV(0);
sv_setpv(SV*, "MATCH");
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(b);
XPUSHs(method_name);
PUTBACK;
count = call_method("can", G_SCALAR);
SPAGAIN;
ret = POPs;
can = SvTRUE(ret);
PUTBACK;
FREETMPS;
LEAVE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment