diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 638c6ac7ff..8937e2ddbc 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.4 2008/01/22 20:19:53 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.5 2009/06/04 16:00:33 adunstan Exp $ * **********************************************************************/ @@ -380,6 +380,8 @@ plperl_init_interp(void) "", "-e", PERLBOOT }; + int nargs = 3; + #ifdef WIN32 /* @@ -422,6 +424,11 @@ plperl_init_interp(void) save_time = loc ? pstrdup(loc) : NULL; #endif +#ifdef PERL_SYS_INIT3 + /* only call this the first time through, as per perlembed man page */ + if (interp_state == INTERP_NONE) + PERL_SYS_INIT3(&nargs, (char ***) &embedding, NULL); +#endif plperl_held_interp = perl_alloc(); if (!plperl_held_interp) @@ -429,7 +436,7 @@ plperl_init_interp(void) perl_construct(plperl_held_interp); perl_parse(plperl_held_interp, plperl_init_shared_libs, - 3, embedding, NULL); + nargs, embedding, NULL); perl_run(plperl_held_interp); if (interp_state == INTERP_NONE)