in reply to Re^4: XS: Passing an external library's function a Perl XS callback
in thread SOLVED: XS: Passing an external library's function a Perl XS callback

Try starting with something that works, and then add to it.
For example, I have no trouble with:
use warnings; use strict; use Inline ('C' => 'DATA'); callback(); sub p_callback { print "in perl callback\n"; } __DATA__ __C__ void callback(){ dSP; PUSHMARK(SP); call_pv("p_callback", G_DISCARD|G_NOARGS); }
Does that work ok for you ? Make sure there's an empty line after the end of the C code.
I don't have libwiringPi, and can't really help with the rest. (If I don't have code that I can actually test then I'm likely to end up presenting misinformation.)

Are you aware of the Inline::C configuration option CLEAN_AFTER_BUILD=>0
It leaves the build directory intact so you can actually inspect the generated XS file and C file - which is sometimes helpful when things aren't working as expected.

Cheers,
Rob

Replies are listed 'Best First'.
Re^6: XS: Passing an external library's function a Perl XS callback
by stevieb (Canon) on Aug 15, 2016 at 13:27 UTC

    Thanks syphilis. As I said above, it does work fine when using callback() locally. I'll try it with the flag you specified and see if I find anything unusual.