Hi inliners, As Brett Denner noted back in 2001 (!!!) at http://www.mail-archive.com/inline@perl.org/msg00263.html , calling a perl sub from Inline::C code twice, using the recommendations from Inline::C-Cookbook, will dump core.
It looks like the stack isn't cleared up correctly after the first call, resulting in subsequent calls getting crud (such as "my" variable names in the called sub) instead of the passed arguments. Workaround: don't use the Inline_Stack_* macros; use the "real" XS ones instead. e.g. Inline_Stack_Vars; Inline_Stack_Reset; Inline_Stack_Push(sv_2mortal(...whatever...)); Inline_Stack_Push(sv_2mortal(...whatever...)); Inline_Stack_Done; call_pv("main::function", G_VOID|G_DISCARD); Inline_Stack_Void; that works once, then gets corrupt data all subsequent times it's called, usually dumping core quite soon. but this works fine: dSP; ENTER; SAVETMPS; PUSHMARK(SP); Inline_Stack_Push(sv_2mortal(...whatever...)); Inline_Stack_Push(sv_2mortal(...whatever...)); PUTBACK; call_pv("main::function", G_VOID|G_DISCARD); FREETMPS; LEAVE; It's probably a bit late to help Brett ;), but I thought I might as well post this message so google will pick it up next time someone tries to follow the example and runs into this. --j.