How to share variables when embedding, cloning perl

How to share variables when embedding, cloning perl

am 30.11.2009 19:34:19 von Sri

Hello,

I havent found any relevant posts on this topic, so hoping the experts can =
rescue me.=A0 My posts on p5p and ithreads didnt get any responses.

I'm extending Perl (with SWIG) and also embedding a cloned interpreter.=A0 =
I use the cloned interpreter to invoke Perl sub's as callbacks.=A0 The call=
back part is working fine.=A0 However, a variable changed in the callback s=
ubroutine is NOT becoming available in the rest of the perl script.

I tried to "use threads:shared" and ":shared" the variable in question, but=
perl exits, complaining that another completely unrelated scalar is "Inval=
id value for shared scalar at". 

How can I "share" variable updates between the main perl script and the cal=
lbacks invokved thru the cloned interpreter?

I'm using v5.8.8 perl.=A0 perl_clone() is using CLONEf_COPY_STACKS | CLONEf=
_KEEP_PTR_TABLE.=A0 The perl sub is sv_dup() with the same flags in CLONE_P=
ARAMS before call_sv().

Please see this post that describes my current code.

http://markmail.org/thread/cjbhybjfikuirvud

Thanks =0A