How to tell the embedded perl in C what's it's working directory?
It seems that it's set to the directory of the executable in which embedded perl is used. Setting the directory from outside before invoking the embedded perl stuff doesn't change it's behaviour.
A possible workaround would be popping in "chdir " before the actual script is started but I don't like that.
My code technically looks like this:
PERL_SYS_INIT3(NULL, NULL, NULL);
my_perl = perl_alloc();
PERL_SET_CONTEXT(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
PERL_SET_CONTEXT(my_perl);
PL_perl_destruct_level = 1;
perl_construct(my_perl);
int argc = 2;
char** argv = new char*[argc];
argv[0] = new char[4096];
argv[0][0] = '\0';
argv[1] = scriptFileName;
PERL_SET_CONTEXT(my_perl);
perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
perl_run(my_perl)
PL_perl_destruct_level = 1;
PERL_SET_CONTEXT(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
my_perl = NULL;
The above outlined code is running in separate threads. Maybe there's something to consider?
Thanks for any hint!