3 # Create the export list for perl. Needed by WIN32 for creating perl.dll.
5 # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
7 my $CCTYPE = "MSVC"; # default
12 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
13 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
16 open(CFG,'config.h') || die "Cannot open config.h:$!";
19 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
20 $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/;
21 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
25 warn join(' ',keys %define)."\n";
27 if ($define{PERL_OBJECT}) {
28 print "LIBRARY PerlCore\n";
29 print "DESCRIPTION 'Perl interpreter'\n";
31 output_symbol("perl_alloc");
37 print "LIBRARY Perl\n";
38 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
42 $define{'PERL_GLOBAL_STRUCT'} = 1;
43 $define{'MULTIPLICITY'} = 1;
54 foreach my $symbol (@$list)
63 foreach my $symbol (@$list)
65 emit_symbol($symbol) unless exists $skip{$symbol};
93 Perl_init_thread_intern
115 if ($define{'MYMALLOC'})
132 Perl_malloced_size)];
135 unless ($define{'USE_THREADS'})
157 Perl_new_struct_thread
158 Perl_per_thread_magicals
165 unless ($define{'USE_THREADS'} or $define{'PERL_IMPLICIT_CONTEXT'})
172 Perl_newSVpvf_nocontext
173 Perl_sv_catpvf_nocontext
174 Perl_sv_setpvf_nocontext
175 Perl_sv_catpvf_mg_nocontext
176 Perl_sv_setpvf_mg_nocontext
180 unless ($define{'FAKE_THREADS'})
182 skip_symbols [qw(PL_curthr)];
188 open(VARS,$file) || die "Cannot open $file:$!";
192 # All symbols have a Perl_ prefix because that's what embed.h
193 # sticks in front of them.
194 push(@syms,"PL_".$1) if (/\bPERLVARI?C?\([IGT](\w+)/);
200 if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
202 my $thrd = readvar("../thrdvar.h");
206 if ($define{'MULTIPLICITY'})
208 my $interp = readvar("../intrpvar.h");
209 skip_symbols $interp;
212 if ($define{'PERL_GLOBAL_STRUCT'})
214 my $global = readvar("../perlvars.h");
215 skip_symbols $global;
216 emit_symbols [qw(Perl_GetVars)];
217 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
220 unless ($define{'DEBUGGING'})
236 if ($define{'HAVE_DES_FCRYPT'})
238 emit_symbols [qw(win32_crypt)];
241 # functions from *.sym files
243 for my $syms ('../global.sym','../pp.sym', '../globvar.sym')
245 open (GLOBAL, "<$syms") || die "failed to open $syms" . $!;
248 next if (!/^[A-Za-z]/);
249 # Functions have a Perl_ prefix
250 # Variables have a PL_ prefix
252 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
254 emit_symbol($symbol) unless exists $skip{$symbol};
261 unless ($define{'PERL_GLOBAL_STRUCT'})
263 my $glob = readvar("../perlvars.h");
267 unless ($define{'MULTIPLICITY'})
269 my $glob = readvar("../intrpvar.h");
273 unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'})
275 my $glob = readvar("../thrdvar.h");
281 next if (!/^[A-Za-z]/);
286 next if exists $skip{$symbol};
287 emit_symbol($symbol);
290 foreach my $symbol (sort keys %export)
292 output_symbol($symbol);
298 $export{$symbol} = 1;
303 if ($CCTYPE eq "BORLAND") {
304 # workaround Borland quirk by exporting both the straight
305 # name and a name with leading underscore. Note the
306 # alias *must* come after the symbol itself, if both
307 # are to be exported. (Linker bug?)
308 print "\t_$symbol\n";
309 print "\t$symbol = _$symbol\n";
311 elsif ($CCTYPE eq 'GCC') {
312 # Symbols have leading _ whole process is $%£"% slow
313 # so skip aliases for now
317 # for binary coexistence, export both the symbol and
318 # alias with leading underscore
320 print "\t_$symbol = $symbol\n";
326 # extra globals not included above.
416 win32_getprotobynumber