David, I have ever seen perlcall, there is an example for calling perl from C but once. (I test it :: OK)
When, C call perl, the sub is executed and did'nt return to C (memory wrap). May be a problem of c ontext. My interpretation is when C had call Perl, Perl is executed and have no reference to return to C code. (:-) ) For information, i'm writing a routine in C to remplace ualarm which did'nt work on Perl under windows. Laurent for (i=0;i<10;i++) { perl_call_pv("main::perl_sub_1", 0); } > Message du 05/03/12 à 13h36 > De : "David Mertens" > A : laurent.ha...@voila.fr > Copie à : inline@perl.org > Objet : Re: calling perl from C > > Laurent - > > Have you seen perlcall? http://perldoc.perl.org/perlcall.html > > Check out the examples section and see if they make sense. If not, let us > know and we'll see if something is broken. FWIW, I've called Perl subs from > my C code before, so I know it's possible. > > David > > On Mon, Mar 5, 2012 at 5:01 AM, wrote: > > > Hello, > > > > First, thanks for the Inline::C package, which is well build, and very > > usefull for me. > > > > I would like that "C code" call "perl sub" but many times. > > > > When I execute the script I have a "panic: memory wrap"... > > > > Is there a solution to do that... > > > > Thanks. > > > > Laurent > > > > use Inline C; > > # use Inline 'NoClean', 'FORCE', 'INFO' ; > > # use Inline Config => WARNINGS => 4; > > > > use strict; > > > > # c_func_1('This is the first line'); > > c_func_2('This is the second line'); > > > > sub perl_sub_1 { > > print map "$_\n", @_; > > } > > > > __DATA__ > > __C__ > > > > void c_func_1(SV* text) { > > c_func_2(text); > > } > > > > void c_func_2(SV* text) { > > > > int i = 0; > > > > for (i=0;i<10;i++) > > { > > perl_call_pv("main::perl_sub_1", 0); > > //SPAGAIN; > > } > > > > } > > > > void cont (void) { > > } > > ___________________________________________________________ > > Les 10 aliments pour lutter contre le rhume ou la grippe sont sur Voila.fr > > http://actu.voila.fr/evenementiel/sante-bien-etre/aliments-anti-rhume/ > > > > > -- > "Debugging is twice as hard as writing the code in the first place. > Therefore, if you write the code as cleverly as possible, you are, > by definition, not smart enough to debug it." -- Brian Kernighan > ___________________________________________________________ Les 10 aliments pour lutter contre le rhume ou la grippe sont sur Voila.fr http://actu.voila.fr/evenementiel/sante-bien-etre/aliments-anti-rhume/