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");
32 output_symbol("perl_get_host_info");
33 output_symbol("perl_alloc_using");
34 # output_symbol("perl_construct");
35 # output_symbol("perl_destruct");
36 # output_symbol("perl_free");
37 # output_symbol("perl_parse");
38 # output_symbol("perl_run");
39 # output_symbol("RunPerl");
43 if ($CCTYPE ne 'GCC') {
44 print "LIBRARY Perl\n";
45 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
48 $define{'PERL_GLOBAL_STRUCT'} = 1;
49 $define{'MULTIPLICITY'} = 1;
59 foreach my $symbol (@$list) {
66 foreach my $symbol (@$list) {
67 my $skipsym = $symbol;
69 if ($define{PERL_OBJECT}) {
70 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
72 emit_symbol($symbol) unless exists $skip{$skipsym};
100 Perl_init_thread_intern
121 if ($define{'PERL_OBJECT'}) {
140 if ($define{'MYMALLOC'})
157 Perl_malloced_size)];
160 unless ($define{'USE_THREADS'})
182 Perl_new_struct_thread
183 Perl_per_thread_magicals
190 unless ($define{'USE_THREADS'} or $define{'PERL_IMPLICIT_CONTEXT'}
191 or $define{'PERL_OBJECT'})
199 Perl_warner_nocontext
200 Perl_newSVpvf_nocontext
201 Perl_sv_catpvf_nocontext
202 Perl_sv_setpvf_nocontext
203 Perl_sv_catpvf_mg_nocontext
204 Perl_sv_setpvf_mg_nocontext
208 unless ($define{'FAKE_THREADS'})
210 skip_symbols [qw(PL_curthr)];
216 my $proc = shift || sub { "PL_$_[2]" };
217 open(VARS,$file) || die "Cannot open $file:$!";
221 # All symbols have a Perl_ prefix because that's what embed.h
222 # sticks in front of them.
223 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
229 if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
231 my $thrd = readvar("../thrdvar.h");
235 if ($define{'MULTIPLICITY'})
237 my $interp = readvar("../intrpvar.h");
238 skip_symbols $interp;
241 if ($define{'PERL_GLOBAL_STRUCT'})
243 my $global = readvar("../perlvars.h");
244 skip_symbols $global;
245 emit_symbols [qw(Perl_GetVars)];
246 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
249 unless ($define{'DEBUGGING'})
265 if ($define{'HAVE_DES_FCRYPT'})
267 emit_symbols [qw(win32_crypt)];
270 # functions from *.sym files
272 for my $syms ('../global.sym','../pp.sym', '../globvar.sym')
274 open (GLOBAL, "<$syms") || die "failed to open $syms" . $!;
277 next if (!/^[A-Za-z]/);
278 # Functions have a Perl_ prefix
279 # Variables have a PL_ prefix
281 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
283 emit_symbol($symbol) unless exists $skip{$symbol};
290 if ($define{'PERL_OBJECT'}) {
291 for my $f ("../perlvars.h", "../intrpvar.h", "../thrdvar.h") {
292 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
297 unless ($define{'PERL_GLOBAL_STRUCT'}) {
298 my $glob = readvar("../perlvars.h");
301 unless ($define{'MULTIPLICITY'}) {
302 my $glob = readvar("../intrpvar.h");
306 unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) {
307 my $glob = readvar("../thrdvar.h");
314 next if (!/^[A-Za-z]/);
319 next if exists $skip{$symbol};
320 emit_symbol($symbol);
323 foreach my $symbol (sort keys %export)
325 output_symbol($symbol);
331 $export{$symbol} = 1;
337 # XXX: binary compatibility between compilers is an exercise
339 # if ($CCTYPE eq "BORLAND") {
340 # # workaround Borland quirk by exporting both the straight
341 # # name and a name with leading underscore. Note the
342 # # alias *must* come after the symbol itself, if both
343 # # are to be exported. (Linker bug?)
344 # print "\t_$symbol\n";
345 # print "\t$symbol = _$symbol\n";
347 # elsif ($CCTYPE eq 'GCC') {
348 # # Symbols have leading _ whole process is $%@"% slow
349 # # so skip aliases for now
350 # print "\t$symbol\n";
353 # # for binary coexistence, export both the symbol and
354 # # alias with leading underscore
355 # print "\t$symbol\n";
356 # print "\t_$symbol = $symbol\n";
362 # extra globals not included above.
452 win32_getprotobynumber