Skip to content
Browse files

Add missing files.

  • Loading branch information...
1 parent 0cf5e60 commit 4994ff0a637bda21a274e32f95a72da2b6175055 Paweł Murias committed Feb 22, 2012
Showing with 41 additions and 0 deletions.
  1. +5 −0 p5test/test6.c
  2. +36 −0 p5test/test6lib.c
View
5 p5test/test6.c
@@ -0,0 +1,5 @@
+extern void run_test(void);
+int main()
+{
+ run_test();
+}
View
36 p5test/test6lib.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <EXTERN.h>
+#include <perl.h>
+
+/* So that we can load XS using modules from our perl */
+EXTERN_C void xs_init (pTHX);
+
+EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
+
+EXTERN_C void
+xs_init(pTHX)
+{
+ char *file = __FILE__;
+ dXSUB_SYS;
+
+ /* DynaLoader is a special case */
+ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
+}
+
+static PerlInterpreter *my_perl;
+int run_test()
+{
+ int argc = 1;
+ char *argv0[] = { "perl", NULL, 0 };
+ char **argv = argv0;
+ PERL_SYS_INIT(&argc,&argv);
+ my_perl = perl_alloc();
+ perl_construct(my_perl);
+ char *embedding[] = { "", "-e", "0" };
+ perl_parse(my_perl, xs_init, 3, embedding, NULL);
+ PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
+ eval_pv("print \"OK 6\\n\"",TRUE);
+ perl_destruct(my_perl);
+ perl_free(my_perl);
+ PERL_SYS_TERM();
+}

0 comments on commit 4994ff0

Please sign in to comment.
Something went wrong with that request. Please try again.