2 # Create the export list for perl.
4 # Needed by WIN32 and OS/2 for creating perl.dll
5 # and by AIX for creating libperl.a when -Dusershrplib is in effect.
7 # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
8 # On OS/2 reads miniperl.map as well
14 (Perl_call_argv => "perl_call_argv",
15 Perl_call_method => "perl_call_method",
16 Perl_call_pv => "perl_call_pv",
17 Perl_call_sv => "perl_call_sv",
18 Perl_get_av => "perl_get_av",
19 Perl_get_cv => "perl_get_cv",
20 Perl_get_hv => "perl_get_hv",
21 Perl_get_sv => "perl_get_sv",
22 Perl_init_i18nl10n => "perl_init_i18nl10n",
23 Perl_init_i18nl14n => "perl_init_i18nl14n",
24 Perl_new_collate => "perl_new_collate",
25 Perl_new_ctype => "perl_new_ctype",
26 Perl_new_numeric => "perl_new_numeric",
27 Perl_require_pv => "perl_require_pv",
28 Perl_safesyscalloc => "Perl_safecalloc",
29 Perl_safesysfree => "Perl_safefree",
30 Perl_safesysmalloc => "Perl_safemalloc",
31 Perl_safesysrealloc => "Perl_saferealloc",
32 Perl_set_numeric_local => "perl_set_numeric_local",
33 Perl_set_numeric_standard => "perl_set_numeric_standard");
35 my $bincompat5005 = join("|", keys %bincompat5005);
40 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
41 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
42 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
43 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
46 my @PLATFORM = qw(aix win32 os2);
48 @PLATFORM{@PLATFORM} = ();
50 defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
51 exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
53 my $config_sh = "config.sh";
54 my $config_h = "config.h";
55 my $thrdvar_h = "thrdvar.h";
56 my $intrpvar_h = "intrpvar.h";
57 my $perlvars_h = "perlvars.h";
58 my $global_sym = "global.sym";
59 my $pp_sym = "pp.sym";
60 my $globvar_sym = "globvar.sym";
61 my $perlio_sym = "perlio.sym";
63 if ($PLATFORM eq 'aix') {
65 } elsif ($PLATFORM eq 'win32') {
66 $CCTYPE = "MSVC" unless defined $CCTYPE;
67 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, $pp_sym, $globvar_sym) {
72 unless ($PLATFORM eq 'win32') {
73 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
76 if (/^(?:ccflags|optimize)='(.+)'$/) {
78 $define{$1} = 1 while /-D(\w+)/g;
80 if ($PLATFORM eq 'os2') {
81 $CONFIG_ARGS = $1 if /^(?:config_args)='(.+)'$/;
82 $ARCHNAME = $1 if /^(?:archname)='(.+)'$/;
88 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
91 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
92 $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/;
93 $define{$1} = 1 if /^\s*#\s*define\s+(USE_PERLIO)\b/;
94 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
95 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_BINCOMPAT_5005)\b/;
99 if ($PLATFORM eq 'win32') {
100 warn join(' ',keys %define)."\n";
101 if ($define{PERL_OBJECT}) {
102 print "LIBRARY Perl56\n";
103 print "DESCRIPTION 'Perl interpreter'\n";
105 # output_symbol("perl_alloc");
106 output_symbol("perl_get_host_info");
107 output_symbol("perl_alloc_using");
108 # output_symbol("perl_construct");
109 # output_symbol("perl_destruct");
110 # output_symbol("perl_free");
111 # output_symbol("perl_parse");
112 # output_symbol("perl_run");
113 # output_symbol("RunPerl");
117 if ($CCTYPE ne 'GCC') {
118 print "LIBRARY Perl\n";
119 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
122 $define{'PERL_GLOBAL_STRUCT'} = 1;
123 $define{'MULTIPLICITY'} = 1;
127 } elsif ($PLATFORM eq 'os2') {
128 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
129 $v .= '-thread' if $ARCHNAME =~ /-thread/;
131 #for (split //, $v) {
132 # $sum = ($sum * 33) + ord;
137 #$sum = printf '%X', $sum;
138 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
139 # print STDERR "'$dll' <= '$define{PERL_DLL}'\n";
141 LIBRARY '$dll' INITINSTANCE TERMINSTANCE
142 DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'
145 DATA LOADONCALL NONSHARED MULTIPLE
148 } elsif ($PLATFORM eq 'aix') {
157 foreach my $symbol (@$list) {
164 foreach my $symbol (@$list) {
165 my $skipsym = $symbol;
167 if ($define{PERL_OBJECT}) {
168 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
170 emit_symbol($symbol) unless exists $skip{$skipsym};
174 if ($PLATFORM eq 'win32') {
199 Perl_init_thread_intern
219 } elsif ($PLATFORM eq 'aix') {
245 if ($PLATFORM eq 'os2') {
269 XS_Cwd_extLibpath_set
273 XS_Cwd_sys_is_absolute
274 XS_Cwd_sys_is_relative
276 XS_DynaLoader_mod2fname
277 XS_File__Copy_syscopy
281 Perl_Process_Messages
288 if ($define{'PERL_OBJECT'}) {
307 if ($define{'MYMALLOC'})
324 Perl_malloced_size)];
327 unless ($define{'USE_THREADS'})
349 Perl_new_struct_thread
350 Perl_per_thread_magicals
357 unless ($define{'USE_THREADS'} or $define{'PERL_IMPLICIT_CONTEXT'}
358 or $define{'PERL_OBJECT'})
367 Perl_warner_nocontext
368 Perl_newSVpvf_nocontext
369 Perl_sv_catpvf_nocontext
370 Perl_sv_setpvf_nocontext
371 Perl_sv_catpvf_mg_nocontext
372 Perl_sv_setpvf_mg_nocontext
376 unless ($define{'FAKE_THREADS'})
378 skip_symbols [qw(PL_curthr)];
384 my $proc = shift || sub { "PL_$_[2]" };
385 open(VARS,$file) || die "Cannot open $file: $!\n";
389 # All symbols have a Perl_ prefix because that's what embed.h
390 # sticks in front of them.
391 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
397 if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
399 my $thrd = readvar($thrdvar_h);
403 if ($define{'MULTIPLICITY'})
405 my $interp = readvar($intrpvar_h);
406 skip_symbols $interp;
409 if ($define{'PERL_GLOBAL_STRUCT'})
411 my $global = readvar($perlvars_h);
412 skip_symbols $global;
413 emit_symbols [qw(Perl_GetVars)];
414 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
417 unless ($define{'DEBUGGING'})
433 if ($PLATFORM eq 'win32' && $define{'HAVE_DES_FCRYPT'})
435 emit_symbols [qw(win32_crypt)];
438 # functions from *.sym files
440 my @syms = ($global_sym, $pp_sym, $globvar_sym);
442 if ($define{'USE_PERLIO'})
444 push @syms, $perlio_sym;
449 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
452 next if (!/^[A-Za-z]/);
453 # Functions have a Perl_ prefix
454 # Variables have a PL_ prefix
456 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
458 emit_symbol($symbol) unless exists $skip{$symbol};
465 if ($define{'PERL_OBJECT'}) {
466 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
467 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
472 unless ($define{'PERL_GLOBAL_STRUCT'}) {
473 my $glob = readvar($perlvars_h);
476 unless ($define{'MULTIPLICITY'}) {
477 my $glob = readvar($intrpvar_h);
481 unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) {
482 my $glob = readvar($thrdvar_h);
490 return if $symbol !~ /^[A-Za-z]/;
491 return if $symbol =~ /^\#/;
494 return if exists $skip{$symbol};
495 emit_symbol($symbol);
502 if ($PLATFORM eq 'win32') {
503 foreach my $symbol (qw(
594 win32_getprotobynumber
653 elsif ($PLATFORM eq 'os2') {
654 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
655 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
656 close MAP or die 'Cannot close miniperl.map';
658 @missing = grep { !exists $mapped{$_} and !exists $bincompat5005{$_} }
660 delete $export{$_} foreach @missing;
663 # Now all symbols should be defined because
664 # next we are going to output them.
666 foreach my $symbol (sort keys %export)
668 output_symbol($symbol);
674 $export{$symbol} = 1;
679 $symbol = $bincompat5005{$symbol}
680 if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
681 if ($PLATFORM eq 'win32') {
682 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
684 # XXX: binary compatibility between compilers is an exercise
686 # if ($CCTYPE eq "BORLAND") {
687 # # workaround Borland quirk by exporting both the straight
688 # # name and a name with leading underscore. Note the
689 # # alias *must* come after the symbol itself, if both
690 # # are to be exported. (Linker bug?)
691 # print "\t_$symbol\n";
692 # print "\t$symbol = _$symbol\n";
694 # elsif ($CCTYPE eq 'GCC') {
695 # # Symbols have leading _ whole process is $%@"% slow
696 # # so skip aliases for now
697 # nprint "\t$symbol\n";
700 # # for binary coexistence, export both the symbol and
701 # # alias with leading underscore
702 # print "\t$symbol\n";
703 # print "\t_$symbol = $symbol\n";
705 } elsif ($PLATFORM eq 'os2') {
706 print qq( "$symbol"\n);
707 } elsif ($PLATFORM eq 'aix') {
714 # extra globals not included above.