diff options
author | David Mitchell <davem@iabyn.com> | 2009-04-02 23:09:01 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2009-04-02 23:09:01 +0100 |
commit | eb53357261107ec40e8c517666330fc71276b6fb (patch) | |
tree | b471091052443cd9381d720b4474afe16430b0f0 | |
parent | e9fd6cc75e3a6bbac72b6b457dc1d06afe6eaf95 (diff) | |
download | perl-eb53357261107ec40e8c517666330fc71276b6fb.tar.gz |
document PERL_SYS_INIT, PERL_SYS_TERM and that they should only be used once
-rw-r--r-- | perl.h | 19 | ||||
-rw-r--r-- | pod/perlapi.pod | 44 | ||||
-rw-r--r-- | pod/perlembed.pod | 15 |
3 files changed, 73 insertions, 5 deletions
@@ -2680,6 +2680,25 @@ typedef struct clone_params CLONE_PARAMS; # define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp) #endif +/* +=for apidoc Am|void|PERL_SYS_INIT|int argc|char** argv +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. + +=for apidoc Am|void|PERL_SYS_INIT3|int argc|char** argv|char** env +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. + +=for apidoc Am|void|PERL_SYS_TERM| +Provides system-specific clean up of the C runtime environment after +running Perl interpreters. This should be called only once, after +freeing any remaining Perl interpreters. + +=cut + */ + #define PERL_SYS_INIT(argc, argv) Perl_sys_init(argc, argv) #define PERL_SYS_INIT3(argc, argv, env) Perl_sys_init3(argc, argv, env) #define PERL_SYS_TERM() Perl_sys_term() diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 0687604d28..7498939e8d 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -1207,6 +1207,50 @@ Found in file mathoms.c =back +=head1 Functions in file perl.h + + +=over 8 + +=item PERL_SYS_INIT +X<PERL_SYS_INIT> + +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. + + void PERL_SYS_INIT(int argc, char** argv) + +=for hackers +Found in file perl.h + +=item PERL_SYS_INIT3 +X<PERL_SYS_INIT3> + +Provides system-specific tune up of the C runtime environment necessary to +run Perl interpreters. This should be called only once, before creating +any Perl interpreters. + + void PERL_SYS_INIT3(int argc, char** argv, char** env) + +=for hackers +Found in file perl.h + +=item PERL_SYS_TERM +X<PERL_SYS_TERM> + +Provides system-specific clean up of the C runtime environment after +running Perl interpreters. This should be called only once, after +freeing any remaining Perl interpreters. + + void PERL_SYS_TERM() + +=for hackers +Found in file perl.h + + +=back + =head1 Functions in file pp_ctl.c diff --git a/pod/perlembed.pod b/pod/perlembed.pod index 39364eb429..161e1ceff5 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -196,11 +196,16 @@ version of I<miniperlmain.c> containing the essentials of embedding: Notice that we don't use the C<env> pointer. Normally handed to C<perl_parse> as its final argument, C<env> here is replaced by -C<NULL>, which means that the current environment will be used. The macros -PERL_SYS_INIT3() and PERL_SYS_TERM() provide system-specific tune up -of the C runtime environment necessary to run Perl interpreters; since -PERL_SYS_INIT3() may change C<env>, it may be more appropriate to provide -C<env> as an argument to perl_parse(). +C<NULL>, which means that the current environment will be used. + +The macros PERL_SYS_INIT3() and PERL_SYS_TERM() provide system-specific +tune up of the C runtime environment necessary to run Perl interpreters; +they should only be called once regardless of how many interpreters you +create or destroy. Call PERL_SYS_INIT3() before you create your first +interpreter, and PERL_SYS_TERM() after you free your last interpreter. + +Since PERL_SYS_INIT3() may change C<env>, it may be more appropriate to +provide C<env> as an argument to perl_parse(). Now compile this program (I'll call it I<interp.c>) into an executable: |