source: perl_tester.c @ 42ad917

release-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 42ad917 was 42ad917, checked in by David Benjamin <davidben@mit.edu>, 15 years ago
Add perl_tester to run perl in barnowl environment Main function shameless borrowed from perldoc perlembed. Signed-off-by: David Benjamin <davidben@mit.edu>
  • Property mode set to 100644
File size: 786 bytes
Line 
1#define OWL_PERL
2#include "owl.h"
3
4owl_global g;
5
6extern XS(boot_BarnOwl);
7extern XS(boot_DynaLoader);
8/* extern XS(boot_DBI); */
9
10static void owl_perl_xs_init(pTHX)
11{
12  const char *file = __FILE__;
13  dXSUB_SYS;
14  {
15    newXS("BarnOwl::bootstrap", boot_BarnOwl, file);
16    newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
17  }
18}
19
20static PerlInterpreter *my_perl;  /***    The Perl interpreter    ***/
21
22int main(int argc, char **argv, char **env)
23{
24  /* Code from perldoc perlembed */
25  PERL_SYS_INIT3(&argc,&argv,&env);
26  my_perl = perl_alloc();
27  perl_construct(my_perl);
28  PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
29  perl_parse(my_perl, owl_perl_xs_init, argc, argv, (char **)NULL);
30  perl_run(my_perl);
31  perl_destruct(my_perl);
32  perl_free(my_perl);
33  PERL_SYS_TERM();
34}
35
Note: See TracBrowser for help on using the repository browser.