ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/App-Staticperl/staticperl.pod
(Generate patch)

Comparing cvsroot/App-Staticperl/staticperl.pod (file contents):
Revision 1.32 by root, Thu Jan 20 21:32:47 2011 UTC vs.
Revision 1.33 by root, Wed Feb 9 10:23:37 2011 UTC

953A header file that contains the prototypes of the few symbols "exported" 953A header file that contains the prototypes of the few symbols "exported"
954by bundle.c, and also exposes the perl headers to the application. 954by bundle.c, and also exposes the perl headers to the application.
955 955
956=over 4 956=over 4
957 957
958=item staticperl_init () 958=item staticperl_init (xs_init = 0)
959 959
960Initialises the perl interpreter. You can use the normal perl functions 960Initialises the perl interpreter. You can use the normal perl functions
961after calling this function, for example, to define extra functions or 961after calling this function, for example, to define extra functions or
962to load a .pm file that contains some initialisation code, or the main 962to load a .pm file that contains some initialisation code, or the main
963program function: 963program function:
970 } 970 }
971 971
972 static void 972 static void
973 run_myapp(void) 973 run_myapp(void)
974 { 974 {
975 staticperl_init (); 975 staticperl_init (0);
976 newXSproto ("myapp::xsfunction", xsfunction, __FILE__, "$$;$"); 976 newXSproto ("myapp::xsfunction", xsfunction, __FILE__, "$$;$");
977 eval_pv ("require myapp::main", 1); // executes "myapp/main.pm" 977 eval_pv ("require myapp::main", 1); // executes "myapp/main.pm"
978 } 978 }
979 979
980When your bootcode already wants to access some XS functions at
981compiletime, then you need to supply an C<xs_init> function pointer that
982is called as soon as perl is initialised enough to define XS functions,
983but before the preamble code is executed:
984
985 static void
986 xs_init (pTHX)
987 {
988 newXSproto ("myapp::xsfunction", xsfunction, __FILE__, "$$;$");
989 }
990
991 static void
992 run_myapp(void)
993 {
994 staticperl_init (xs_init);
995 }
996
997=item staticperl_cleanup ()
998
999In the unlikely case that you want to destroy the perl interpreter, here
1000is the corresponding function.
1001
980=item staticperl_xs_init (pTHX) 1002=item staticperl_xs_init (pTHX)
981 1003
982Sometimes you need direct control over C<perl_parse> and C<perl_run>, in 1004Sometimes you need direct control over C<perl_parse> and C<perl_run>, in
983which case you do not want to use C<staticperl_init> but call them on your 1005which case you do not want to use C<staticperl_init> but call them on your
984own. 1006own.
985 1007
986Then you need this function - either pass it directly as the C<xs_init> 1008Then you need this function - either pass it directly as the C<xs_init>
987function to C<perl_parse>, or call it from your own C<xs_init> function. 1009function to C<perl_parse>, or call it as one of the first things from your
988 1010own C<xs_init> function.
989=item staticperl_cleanup ()
990
991In the unlikely case that you want to destroy the perl interpreter, here
992is the corresponding function.
993 1011
994=item PerlInterpreter *staticperl 1012=item PerlInterpreter *staticperl
995 1013
996The perl interpreter pointer used by staticperl. Not normally so useful, 1014The perl interpreter pointer used by staticperl. Not normally so useful,
997but there it is. 1015but there it is.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines