in reply to How @INC can be managed from c code?

I think that @INC is just another Perl variable. You could either run Perl code to populate @INC:

push @INC, '/opt/myapp/lib';

... or you could do the same in C:

AV * PL_inc = get_av("INC",0); if( ! PL_inc ) { Perl_croak(aTHX_ "@INC not found from C code?!"); }; av_push(results, newSVpv("/opt/myapp/lib"));

Replies are listed 'Best First'.
Re^2: How @INC can be managed from c code?
by DrMoisha (Novice) on Apr 01, 2015 at 15:00 UTC
    Have you meant
    av_push(PL_inc, newSVpv("/opt/myapp/lib", 15));
    However, it can only be called after perl_parse() So maybe I'm on wrong way.

      Yeah, the results was a leftover from pasting together the code. I don't really do C, and don't interact much from C-space with the Perl interpreter, but I think you can call perl_parse() multiple times, just like -e does.