in reply to Perlembed: problem with exception

strcpy(error, SvPV(ERRSV, PL_na));

Looks like you're trying to copy into the 'error' variable what is already in $@. You want to use sv_setpv instead of strcpy - see 'perldoc perlclib'.

Here's a simplified Inline C example that works fine for me.
use warnings; use Inline C => Config => BUILD_NOISY => 1; sub register_vm { die "register_vm() has died"; } use Inline C => <<'EOC'; SV * foo(char * config) { int bRet = 1; STRLEN n_a; dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSVpv(config, 0))); PUTBACK; perl_call_pv("register_vm", G_DISCARD|G_EVAL); SPAGAIN; if(SvTRUE(ERRSV)) { printf ("From C: %s\n", SvPV(ERRSV, n_a)); bRet = 0; } PUTBACK; FREETMPS; LEAVE; return newSViv(bRet); } EOC $ret = foo('arg'); print "Perl's \$\@ contains: $@\n\$ret: $ret\n";
It outputs:
From C: register_vm() has died at try.pl line 5. Perl's $@ contains: register_vm() has died at try.pl line 5. $ret: 0
Not quite sure what your original aim was. Hopefully, with the help of 'perldoc perlapi' and the other docs I've already mentioned, you can work out how to modify that script to suit your needs. If not, post again.

Cheers,
Rob