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') {
268 XS_Cwd_extLibpath_set
272 XS_Cwd_sys_is_absolute
273 XS_Cwd_sys_is_relative
275 XS_DynaLoader_mod2fname
276 XS_File__Copy_syscopy
280 Perl_Process_Messages
287 if ($define{'PERL_OBJECT'}) {
306 if ($define{'MYMALLOC'})
323 Perl_malloced_size)];
326 unless ($define{'USE_THREADS'})
348 Perl_new_struct_thread
349 Perl_per_thread_magicals
356 unless ($define{'USE_THREADS'} or $define{'PERL_IMPLICIT_CONTEXT'}
357 or $define{'PERL_OBJECT'})
365 Perl_warner_nocontext
366 Perl_newSVpvf_nocontext
367 Perl_sv_catpvf_nocontext
368 Perl_sv_setpvf_nocontext
369 Perl_sv_catpvf_mg_nocontext
370 Perl_sv_setpvf_mg_nocontext
374 unless ($define{'FAKE_THREADS'})
376 skip_symbols [qw(PL_curthr)];
382 my $proc = shift || sub { "PL_$_[2]" };
383 open(VARS,$file) || die "Cannot open $file: $!\n";
387 # All symbols have a Perl_ prefix because that's what embed.h
388 # sticks in front of them.
389 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
395 if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
397 my $thrd = readvar($thrdvar_h);
401 if ($define{'MULTIPLICITY'})
403 my $interp = readvar($intrpvar_h);
404 skip_symbols $interp;
407 if ($define{'PERL_GLOBAL_STRUCT'})
409 my $global = readvar($perlvars_h);
410 skip_symbols $global;
411 emit_symbols [qw(Perl_GetVars)];
412 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
415 unless ($define{'DEBUGGING'})
431 if ($PLATFORM eq 'win32' && $define{'HAVE_DES_FCRYPT'})
433 emit_symbols [qw(win32_crypt)];
436 # functions from *.sym files
438 my @syms = ($global_sym, $pp_sym, $globvar_sym);
440 if ($define{'USE_PERLIO'})
442 push @syms, $perlio_sym;
447 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
450 next if (!/^[A-Za-z]/);
451 # Functions have a Perl_ prefix
452 # Variables have a PL_ prefix
454 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
456 emit_symbol($symbol) unless exists $skip{$symbol};
463 if ($define{'PERL_OBJECT'}) {
464 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
465 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
470 unless ($define{'PERL_GLOBAL_STRUCT'}) {
471 my $glob = readvar($perlvars_h);
474 unless ($define{'MULTIPLICITY'}) {
475 my $glob = readvar($intrpvar_h);
479 unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) {
480 my $glob = readvar($thrdvar_h);
488 return if $symbol !~ /^[A-Za-z]/;
489 return if $symbol =~ /^\#/;
492 return if exists $skip{$symbol};
493 emit_symbol($symbol);
500 if ($PLATFORM eq 'win32') {
501 foreach my $symbol (qw(
592 win32_getprotobynumber
651 elsif ($PLATFORM eq 'os2') {
652 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
653 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
654 close MAP or die 'Cannot close miniperl.map';
656 @missing = grep { !exists $mapped{$_} } keys %export;
657 delete $export{$_} foreach @missing;
660 # Now all symbols should be defined because
661 # next we are going to output them.
663 foreach my $symbol (sort keys %export)
665 output_symbol($symbol);
671 $export{$symbol} = 1;
676 $symbol = $bincompat5005{$symbol}
677 if $define{PERL_BINCOMPAT_5005} and $symbol =~ /^($bincompat5005)$/;
678 if ($PLATFORM eq 'win32') {
679 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
681 # XXX: binary compatibility between compilers is an exercise
683 # if ($CCTYPE eq "BORLAND") {
684 # # workaround Borland quirk by exporting both the straight
685 # # name and a name with leading underscore. Note the
686 # # alias *must* come after the symbol itself, if both
687 # # are to be exported. (Linker bug?)
688 # print "\t_$symbol\n";
689 # print "\t$symbol = _$symbol\n";
691 # elsif ($CCTYPE eq 'GCC') {
692 # # Symbols have leading _ whole process is $%@"% slow
693 # # so skip aliases for now
694 # nprint "\t$symbol\n";
697 # # for binary coexistence, export both the symbol and
698 # # alias with leading underscore
699 # print "\t$symbol\n";
700 # print "\t_$symbol = $symbol\n";
702 } elsif ($PLATFORM eq 'os2') {
703 print qq( "$symbol"\n);
704 } elsif ($PLATFORM eq 'aix') {
711 # extra globals not included above.