there is an example in the C cookbook of calling perl from an Inline::C function. the example works on my system (RHEL 3, gcc 3.2.3, and perl 5.8.8).
i have a more complex program that uses josh pritikin's Event module. i'm trying to use Inline::C to integrate a C++ library into the program. yes, that's right - Inline::C for a C++ library! i've interposed a thin C wrapper layer because Inline::CPP was a little too unwieldy to use directly in this case. there is an Inline::C function in the complex program that tries to call back to perl. eventually, it will pass a wrapped C++ runtime object which will behave like a read-only hash. but for now, the callback is just passing a string, exactly like the working example from from the Inline C Cookbook. however, the callback in the complex program SEGV's within 'call_pv'. here is the source that causes the crash: void pass_to_perl (void *p) { Inline_Stack_Vars; Inline_Stack_Push (newSVpvf ("this is an arg string")); Inline_Stack_Done; call_pv ("main::callback", 0); Inline_Stack_Void; } if i run the complex program with a perl binary compiled with "-g -DDEBUGGING", i get the error message: Event: trapped error in `Handler': panic: memory wrap at ./xx line 162. the stack trace from the optimized perl binary when it SEGV's looks like this: (gdb) where #0 0x00c8423c in memcpy () from /lib/tls/libc.so.6 #1 0x00569366 in Perl_pp_entersub () from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so #2 0x0050177c in Perl_call_sv () from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so #3 0x00501617 in Perl_call_sv () from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so #4 0x00500dd4 in Perl_call_pv () from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so #5 0x00700334 in pass_to_perl (p=0x9056008) at xx_0e2e.xs:31 (other frames elided for the sake of brevity...) this has me stopped cold. any thoughts/suggestions? any way to get more info? /mark