1 # This File keeps the contents of miniperlmain.c.
3 # It was generated automatically by minimod.PL from the contents
4 # of miniperlmain.c. Don't edit this file!
6 # ANY CHANGES MADE HERE WILL BE LOST!
10 package ExtUtils
::Miniperl
;
13 @EXPORT = qw(&writemain);
17 * "The Road goes ever on and on, down from the door where it began."
21 #pragma runopts(HEAP(1M,32K,ANYWHERE,KEEP,8K,4K))
26 #define PERL_IN_MINIPERLMAIN_C
29 static void xs_init (pTHX);
30 static PerlInterpreter *my_perl;
32 #if defined (__MINT__) || defined (atarist)
33 /* The Atari operating system doesn't have a dynamic stack. The
34 stack size is determined from this value. */
35 long _stksize = 64 * 1024;
39 main(int argc, char **argv, char **env)
43 #ifdef PERL_GLOBAL_STRUCT
44 #define PERLVAR(var,type) /**/
45 #define PERLVARA(var,type) /**/
46 #define PERLVARI(var,type,init) PL_Vars.var = init;
47 #define PERLVARIC(var,type,init) PL_Vars.var = init;
55 PERL_SYS_INIT3(&argc,&argv,&env);
58 my_perl = perl_alloc();
61 perl_construct(my_perl);
62 PL_perl_destruct_level = 0;
65 exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
67 exitstatus = perl_run(my_perl);
70 perl_destruct(my_perl);
79 /* Register any extra external extensions */
94 my($dl) = canon
('/','DynaLoader');
98 my($pname) = canon
('/', $_);
100 ($mname = $pname) =~ s!/!::!g;
101 ($cname = $pname) =~ s!/!__!g;
102 print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
105 my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
108 print "\tchar *file = __FILE__;\n";
109 print "\tdXSUB_SYS;\n" if $] > 5.002;
112 my($pname) = canon
('/', $_);
113 my($mname, $cname, $ccode);
114 ($mname = $pname) =~ s!/!::!g;
115 ($cname = $pname) =~ s!/!__!g;
118 # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
119 # boot_DynaLoader is called directly in DynaLoader.pm
120 $ccode = "\t/* DynaLoader is a special case */\n
121 \tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n";
122 print $ccode unless $SEEN{$ccode}++;
124 $ccode = "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n";
125 print $ccode unless $SEEN{$ccode}++;
135 # might be X::Y or lib/auto/X/Y/Y.a
137 s
:^(lib
|ext
)/(auto/)?
::;
140 grep(s
:/:$as:, @ext) if ($as ne '/');
149 ExtUtils::Miniperl, writemain - write the C code for perlmain.c
153 C<use ExtUtils::Miniperl;>
155 C<writemain(@directories);>
159 This whole module is written when perl itself is built from a script
160 called minimod.PL. In case you want to patch it, please patch
161 minimod.PL in the perl distribution instead.
163 writemain() takes an argument list of directories containing archive
164 libraries that relate to perl modules and should be linked into a new
165 perl binary. It writes to STDOUT a corresponding perlmain.c file that
166 is a plain C file containing all the bootstrap code to make the
167 modules associated with the libraries available from within perl.
169 The typical usage is from within a Makefile generated by
170 ExtUtils::MakeMaker. So under normal circumstances you won't have to
171 deal with this module directly
.
175 L<ExtUtils::MakeMaker>