This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Perl PR: "Security holes in Sys::Syslog"
[perl5.git] / makedef.pl
1 #
2 # Create the export list for perl.
3 #
4 # Needed by WIN32 and OS/2 for creating perl.dll,
5 # and by AIX for creating libperl.a when -Dusershrplib is in effect,
6 # and by MacOS Classic.
7 #
8 # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
9 # On OS/2 reads miniperl.map and the previous version of perl5.def as well
10
11 my $PLATFORM;
12 my $CCTYPE;
13
14 while (@ARGV) {
15     my $flag = shift;
16     if ($flag =~ s/^CC_FLAGS=/ /) {
17         for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
18             $fflag     .= '=1' unless $fflag =~ /^(\w+)=/;
19             $define{$1} = $2   if $fflag =~ /^(\w+)=(.+)$/;
20         }
21         next;
22     }
23     $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
24     $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
25     $CCTYPE   = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
26     $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
27     if ($PLATFORM eq 'netware') {
28         $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
29     }
30 }
31
32 my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
33 my %PLATFORM;
34 @PLATFORM{@PLATFORM} = ();
35
36 defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
37 exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
38
39 if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") {
40         # Add the compile-time options that miniperl was built with to %define.
41         # On Win32 these are not the same options as perl itself will be built
42         # with since miniperl is built with a canned config (one of the win32/
43         # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
44         # but they do include some #define's that are hard-coded in various
45         # source files and header files and don't include any BUILDOPT's that
46         # the user might have chosen to disable because the canned configs are
47         # minimal configs that don't include any of those options.
48         my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); # for wince need Cross.pm to get Config.pm
49         my $config = `$^X $opts -Ilib -V`;
50         my($options) = $config =~ /^  Compile-time options: (.*?)\n^  \S/ms;
51         $options =~ s/\s+/ /g;
52         print STDERR "Options: ($options)\n";
53         foreach (split /\s+/, $options) {
54                 $define{$_} = 1;
55         }
56 }
57
58 my %exportperlmalloc =
59     (
60        Perl_malloc              =>      "malloc",
61        Perl_mfree               =>      "free",
62        Perl_realloc             =>      "realloc",
63        Perl_calloc              =>      "calloc",
64     );
65
66 my $exportperlmalloc = $PLATFORM eq 'os2';
67
68 my $config_sh   = "config.sh";
69 my $config_h    = "config.h";
70 my $thrdvar_h   = "thrdvar.h";
71 my $intrpvar_h  = "intrpvar.h";
72 my $perlvars_h  = "perlvars.h";
73 my $global_sym  = "global.sym";
74 my $pp_sym      = "pp.sym";
75 my $globvar_sym = "globvar.sym";
76 my $perlio_sym  = "perlio.sym";
77 my $static_ext = "";
78
79 if ($PLATFORM eq 'aix') {
80     # Nothing for now.
81 }
82 elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
83     $CCTYPE = "MSVC" unless defined $CCTYPE;
84     foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
85              $pp_sym, $globvar_sym, $perlio_sym) {
86         s!^!..\\!;
87     }
88 }
89 elsif ($PLATFORM eq 'MacOS') {
90     foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
91              $pp_sym, $globvar_sym, $perlio_sym) {
92         s!^!::!;
93     }
94 }
95
96 unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
97     open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
98     while (<CFG>) {
99         if (/^(?:ccflags|optimize)='(.+)'$/) {
100             $_ = $1;
101             $define{$1} = 1 while /-D(\w+)/g;
102         }
103         if (/^(d_(?:mmap|sigaction))='(.+)'$/) {
104             $define{$1} = $2;
105         }
106         if ($PLATFORM eq 'os2') {
107             $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
108             $ARCHNAME =    $1 if /^archname='(.+)'$/;
109             $PATCHLEVEL =  $1 if /^perl_patchlevel='(.+)'$/;
110         }
111     }
112     close(CFG);
113 }
114 if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
115     open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
116     if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
117         $static_ext = $1;
118     }
119     close(CFG);
120 }
121
122 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
123 while (<CFG>) {
124     $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
125     $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
126     $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
127     $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
128 }
129 close(CFG);
130
131 # perl.h logic duplication begins
132
133 if ($define{PERL_IMPLICIT_SYS}) {
134     $define{PL_OP_SLAB_ALLOC} = 1;
135 }
136
137 if ($define{USE_ITHREADS}) {
138     if (!$define{MULTIPLICITY}) {
139         $define{MULTIPLICITY} = 1;
140     }
141 }
142
143 $define{PERL_IMPLICIT_CONTEXT} ||=
144     $define{USE_ITHREADS} ||
145     $define{MULTIPLICITY} ;
146
147 if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
148     $define{USE_REENTRANT_API} = 1;
149 }
150
151 # perl.h logic duplication ends
152
153 my $sym_ord = 0;
154
155 print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
156
157 if ($PLATFORM =~ /^win(?:32|ce)$/) {
158     ($dll = ($define{PERL_DLL} || "perl59")) =~ s/\.dll$//i;
159     print "LIBRARY $dll\n";
160     print "DESCRIPTION 'Perl interpreter'\n";
161     print "EXPORTS\n";
162     if ($define{PERL_IMPLICIT_SYS}) {
163         output_symbol("perl_get_host_info");
164         output_symbol("perl_alloc_override");
165     }
166     if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
167         output_symbol("perl_clone_host");
168     }
169 }
170 elsif ($PLATFORM eq 'os2') {
171     if (open my $fh, '<', 'perl5.def') {
172       while (<$fh>) {
173         last if /^\s*EXPORTS\b/;
174       }
175       while (<$fh>) {
176         $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
177         # This allows skipping ordinals which were used in older versions
178         $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
179       }
180       $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
181     }
182     ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
183     $v .= '-thread' if $ARCHNAME =~ /-thread/;
184     ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
185     $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
186     $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
187     $d = substr($d, 0, 249) . "...'" if length $d > 253;
188     print <<"---EOP---";
189 LIBRARY '$dll' INITINSTANCE TERMINSTANCE
190 $d
191 STACKSIZE 32768
192 CODE LOADONCALL
193 DATA LOADONCALL NONSHARED MULTIPLE
194 EXPORTS
195 ---EOP---
196 }
197 elsif ($PLATFORM eq 'aix') {
198     $OSVER = `uname -v`;
199     chop $OSVER;
200     $OSREL = `uname -r`;
201     chop $OSREL;
202     if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
203         print "#! ..\n";
204     } else {
205         print "#!\n";
206     }
207 }
208 elsif ($PLATFORM eq 'netware') {
209         if ($FILETYPE eq 'def') {
210         print "LIBRARY perl59\n";
211         print "DESCRIPTION 'Perl interpreter for NetWare'\n";
212         print "EXPORTS\n";
213         }
214         if ($define{PERL_IMPLICIT_SYS}) {
215             output_symbol("perl_get_host_info");
216             output_symbol("perl_alloc_override");
217             output_symbol("perl_clone_host");
218         }
219 }
220
221 my %skip;
222 my %export;
223
224 sub skip_symbols {
225     my $list = shift;
226     foreach my $symbol (@$list) {
227         $skip{$symbol} = 1;
228     }
229 }
230
231 sub emit_symbols {
232     my $list = shift;
233     foreach my $symbol (@$list) {
234         my $skipsym = $symbol;
235         # XXX hack
236         if ($define{MULTIPLICITY}) {
237             $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
238         }
239         emit_symbol($symbol) unless exists $skip{$skipsym};
240     }
241 }
242
243 if ($PLATFORM eq 'win32') {
244     skip_symbols [qw(
245                      PL_statusvalue_vms
246                      PL_archpat_auto
247                      PL_cryptseen
248                      PL_DBcv
249                      PL_generation
250                      PL_lastgotoprobe
251                      PL_linestart
252                      PL_modcount
253                      PL_pending_ident
254                      PL_sublex_info
255                      PL_timesbuf
256                      main
257                      Perl_ErrorNo
258                      Perl_GetVars
259                      Perl_do_exec3
260                      Perl_do_ipcctl
261                      Perl_do_ipcget
262                      Perl_do_msgrcv
263                      Perl_do_msgsnd
264                      Perl_do_semop
265                      Perl_do_shmio
266                      Perl_dump_fds
267                      Perl_init_thread_intern
268                      Perl_my_bzero
269                      Perl_my_bcopy
270                      Perl_my_htonl
271                      Perl_my_ntohl
272                      Perl_my_swap
273                      Perl_my_chsize
274                      Perl_same_dirent
275                      Perl_setenv_getix
276                      Perl_unlnk
277                      Perl_watch
278                      Perl_safexcalloc
279                      Perl_safexmalloc
280                      Perl_safexfree
281                      Perl_safexrealloc
282                      Perl_my_memcmp
283                      Perl_my_memset
284                      PL_cshlen
285                      PL_cshname
286                      PL_opsave
287                      Perl_do_exec
288                      Perl_getenv_len
289                      Perl_my_pclose
290                      Perl_my_popen
291                      )];
292 }
293 else {
294     skip_symbols [qw(
295                      Perl_do_spawn
296                      Perl_do_spawn_nowait
297                      Perl_do_aspawn
298                      )];
299 }
300 if ($PLATFORM eq 'wince') {
301     skip_symbols [qw(
302                      PL_statusvalue_vms
303                      PL_archpat_auto
304                      PL_cryptseen
305                      PL_DBcv
306                      PL_generation
307                      PL_lastgotoprobe
308                      PL_linestart
309                      PL_modcount
310                      PL_pending_ident
311                      PL_sublex_info
312                      PL_timesbuf
313                      PL_collation_ix
314                      PL_collation_name
315                      PL_collation_standard
316                      PL_collxfrm_base
317                      PL_collxfrm_mult
318                      PL_numeric_compat1
319                      PL_numeric_local
320                      PL_numeric_name
321                      PL_numeric_radix_sv
322                      PL_numeric_standard
323                      PL_vtbl_collxfrm
324                      Perl_sv_collxfrm
325                      setgid
326                      setuid
327                      win32_free_childdir
328                      win32_free_childenv
329                      win32_get_childdir
330                      win32_get_childenv
331                      win32_spawnvp
332                      main
333                      Perl_ErrorNo
334                      Perl_GetVars
335                      Perl_do_exec3
336                      Perl_do_ipcctl
337                      Perl_do_ipcget
338                      Perl_do_msgrcv
339                      Perl_do_msgsnd
340                      Perl_do_semop
341                      Perl_do_shmio
342                      Perl_dump_fds
343                      Perl_init_thread_intern
344                      Perl_my_bzero
345                      Perl_my_bcopy
346                      Perl_my_htonl
347                      Perl_my_ntohl
348                      Perl_my_swap
349                      Perl_my_chsize
350                      Perl_same_dirent
351                      Perl_setenv_getix
352                      Perl_unlnk
353                      Perl_watch
354                      Perl_safexcalloc
355                      Perl_safexmalloc
356                      Perl_safexfree
357                      Perl_safexrealloc
358                      Perl_my_memcmp
359                      Perl_my_memset
360                      PL_cshlen
361                      PL_cshname
362                      PL_opsave
363                      Perl_do_exec
364                      Perl_getenv_len
365                      Perl_my_pclose
366                      Perl_my_popen
367                      )];
368 }
369 elsif ($PLATFORM eq 'aix') {
370     skip_symbols([qw(
371                      Perl_dump_fds
372                      Perl_ErrorNo
373                      Perl_GetVars
374                      Perl_my_bcopy
375                      Perl_my_bzero
376                      Perl_my_chsize
377                      Perl_my_htonl
378                      Perl_my_memcmp
379                      Perl_my_memset
380                      Perl_my_ntohl
381                      Perl_my_swap
382                      Perl_safexcalloc
383                      Perl_safexfree
384                      Perl_safexmalloc
385                      Perl_safexrealloc
386                      Perl_same_dirent
387                      Perl_unlnk
388                      Perl_sys_intern_clear
389                      Perl_sys_intern_dup
390                      Perl_sys_intern_init
391                      PL_cryptseen
392                      PL_opsave
393                      PL_statusvalue_vms
394                      PL_sys_intern
395                      )]);
396 }
397 elsif ($PLATFORM eq 'os2') {
398     emit_symbols([qw(
399                     ctermid
400                     get_sysinfo
401                     Perl_OS2_init
402                     Perl_OS2_init3
403                     Perl_OS2_term
404                     OS2_Perl_data
405                     dlopen
406                     dlsym
407                     dlerror
408                     dlclose
409                     dup2
410                     dup
411                     my_tmpfile
412                     my_tmpnam
413                     my_flock
414                     my_rmdir
415                     my_mkdir
416                     my_getpwuid
417                     my_getpwnam
418                     my_getpwent
419                     my_setpwent
420                     my_endpwent
421                     fork_with_resources
422                     croak_with_os2error
423                     setgrent
424                     endgrent
425                     getgrent
426                     malloc_mutex
427                     threads_mutex
428                     nthreads
429                     nthreads_cond
430                     os2_cond_wait
431                     os2_stat
432                     os2_execname
433                     async_mssleep
434                     msCounter
435                     InfoTable
436                     pthread_join
437                     pthread_create
438                     pthread_detach
439                     XS_Cwd_change_drive
440                     XS_Cwd_current_drive
441                     XS_Cwd_extLibpath
442                     XS_Cwd_extLibpath_set
443                     XS_Cwd_sys_abspath
444                     XS_Cwd_sys_chdir
445                     XS_Cwd_sys_cwd
446                     XS_Cwd_sys_is_absolute
447                     XS_Cwd_sys_is_relative
448                     XS_Cwd_sys_is_rooted
449                     XS_DynaLoader_mod2fname
450                     XS_File__Copy_syscopy
451                     Perl_Register_MQ
452                     Perl_Deregister_MQ
453                     Perl_Serve_Messages
454                     Perl_Process_Messages
455                     init_PMWIN_entries
456                     PMWIN_entries
457                     Perl_hab_GET
458                     loadByOrdinal
459                     pExtFCN
460                     os2error
461                     ResetWinError
462                     CroakWinError
463                     PL_do_undump
464                     )]);
465     emit_symbols([qw(os2_cond_wait
466                      pthread_join
467                      pthread_create
468                      pthread_detach
469                     )])
470       if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
471 }
472 elsif ($PLATFORM eq 'MacOS') {
473     skip_symbols [qw(
474                     Perl_GetVars
475                     PL_cryptseen
476                     PL_cshlen
477                     PL_cshname
478                     PL_statusvalue_vms
479                     PL_sys_intern
480                     PL_opsave
481                     PL_timesbuf
482                     Perl_dump_fds
483                     Perl_my_bcopy
484                     Perl_my_bzero
485                     Perl_my_chsize
486                     Perl_my_htonl
487                     Perl_my_memcmp
488                     Perl_my_memset
489                     Perl_my_ntohl
490                     Perl_my_swap
491                     Perl_safexcalloc
492                     Perl_safexfree
493                     Perl_safexmalloc
494                     Perl_safexrealloc
495                     Perl_unlnk
496                     Perl_sys_intern_clear
497                     Perl_sys_intern_init
498                     )];
499 }
500 elsif ($PLATFORM eq 'netware') {
501         skip_symbols [qw(
502                         PL_statusvalue_vms
503                         PL_archpat_auto
504                         PL_cryptseen
505                         PL_DBcv
506                         PL_generation
507                         PL_lastgotoprobe
508                         PL_linestart
509                         PL_modcount
510                         PL_pending_ident
511                         PL_sublex_info
512                         PL_timesbuf
513                         main
514                         Perl_ErrorNo
515                         Perl_GetVars
516                         Perl_do_exec3
517                         Perl_do_ipcctl
518                         Perl_do_ipcget
519                         Perl_do_msgrcv
520                         Perl_do_msgsnd
521                         Perl_do_semop
522                         Perl_do_shmio
523                         Perl_dump_fds
524                         Perl_init_thread_intern
525                         Perl_my_bzero
526                         Perl_my_htonl
527                         Perl_my_ntohl
528                         Perl_my_swap
529                         Perl_my_chsize
530                         Perl_same_dirent
531                         Perl_setenv_getix
532                         Perl_unlnk
533                         Perl_watch
534                         Perl_safexcalloc
535                         Perl_safexmalloc
536                         Perl_safexfree
537                         Perl_safexrealloc
538                         Perl_my_memcmp
539                         Perl_my_memset
540                         PL_cshlen
541                         PL_cshname
542                         PL_opsave
543                         Perl_do_exec
544                         Perl_getenv_len
545                         Perl_my_pclose
546                         Perl_my_popen
547                         Perl_sys_intern_init
548                         Perl_sys_intern_dup
549                         Perl_sys_intern_clear
550                         Perl_my_bcopy
551                         Perl_PerlIO_write
552                         Perl_PerlIO_unread
553                         Perl_PerlIO_tell
554                         Perl_PerlIO_stdout
555                         Perl_PerlIO_stdin
556                         Perl_PerlIO_stderr
557                         Perl_PerlIO_setlinebuf
558                         Perl_PerlIO_set_ptrcnt
559                         Perl_PerlIO_set_cnt
560                         Perl_PerlIO_seek
561                         Perl_PerlIO_read
562                         Perl_PerlIO_get_ptr
563                         Perl_PerlIO_get_cnt
564                         Perl_PerlIO_get_bufsiz
565                         Perl_PerlIO_get_base
566                         Perl_PerlIO_flush
567                         Perl_PerlIO_fill
568                         Perl_PerlIO_fileno
569                         Perl_PerlIO_error
570                         Perl_PerlIO_eof
571                         Perl_PerlIO_close
572                         Perl_PerlIO_clearerr
573                         PerlIO_perlio
574                         )];
575 }
576
577 unless ($define{'DEBUGGING'}) {
578     skip_symbols [qw(
579                     Perl_deb_growlevel
580                     Perl_debop
581                     Perl_debprofdump
582                     Perl_debstack
583                     Perl_debstackptrs
584                     Perl_sv_peek
585                     PL_block_type
586                     PL_watchaddr
587                     PL_watchok
588                     PL_watch_pvx
589                     )];
590 }
591
592 if ($define{'PERL_IMPLICIT_CONTEXT'}) {
593     skip_symbols [qw(
594                     PL_sig_sv
595                     )];
596 }
597
598 if ($define{'PERL_IMPLICIT_SYS'}) {
599     skip_symbols [qw(
600                     Perl_getenv_len
601                     Perl_my_popen
602                     Perl_my_pclose
603                     )];
604 }
605 else {
606     skip_symbols [qw(
607                     PL_Mem
608                     PL_MemShared
609                     PL_MemParse
610                     PL_Env
611                     PL_StdIO
612                     PL_LIO
613                     PL_Dir
614                     PL_Sock
615                     PL_Proc
616                     )];
617 }
618
619 unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
620     skip_symbols [qw(
621                     Perl_sv_setsv_cow
622                     Perl_sv_release_IVX
623                   )];
624 }
625
626 unless ($define{'USE_REENTRANT_API'}) {
627     skip_symbols [qw(
628                     PL_reentrant_buffer
629                     )];
630 }
631
632 if ($define{'MYMALLOC'}) {
633     emit_symbols [qw(
634                     Perl_dump_mstats
635                     Perl_get_mstats
636                     Perl_strdup
637                     Perl_putenv
638                     MallocCfg_ptr
639                     MallocCfgP_ptr
640                     )];
641     if ($define{'USE_ITHREADS'}) {
642         emit_symbols [qw(
643                         PL_malloc_mutex
644                         )];
645     }
646     else {
647         skip_symbols [qw(
648                         PL_malloc_mutex
649                         )];
650     }
651 }
652 else {
653     skip_symbols [qw(
654                     PL_malloc_mutex
655                     Perl_dump_mstats
656                     Perl_get_mstats
657                     Perl_malloced_size
658                     MallocCfg_ptr
659                     MallocCfgP_ptr
660                     )];
661 }
662
663 if ($define{'PERL_USE_SAFE_PUTENV'}) {
664     skip_symbols [qw(
665                    PL_use_safe_putenv
666                   )];
667 }
668
669 unless ($define{'USE_ITHREADS'}) {
670     skip_symbols [qw(
671                     PL_thr_key
672                     )];
673 }
674
675 # USE_5005THREADS symbols. Kept as reference for easier removal
676     skip_symbols [qw(
677                     PL_sv_mutex
678                     PL_strtab_mutex
679                     PL_svref_mutex
680                     PL_cred_mutex
681                     PL_eval_mutex
682                     PL_fdpid_mutex
683                     PL_sv_lock_mutex
684                     PL_eval_cond
685                     PL_eval_owner
686                     PL_threads_mutex
687                     PL_nthreads
688                     PL_nthreads_cond
689                     PL_threadnum
690                     PL_threadsv_names
691                     PL_thrsv
692                     PL_vtbl_mutex
693                     Perl_condpair_magic
694                     Perl_new_struct_thread
695                     Perl_per_thread_magicals
696                     Perl_thread_create
697                     Perl_find_threadsv
698                     Perl_unlock_condpair
699                     Perl_magic_mutexfree
700                     Perl_sv_lock
701                     )];
702
703 unless ($define{'USE_ITHREADS'}) {
704     skip_symbols [qw(
705                     PL_ptr_table
706                     PL_pte_root
707                     PL_pte_arenaroot
708                     PL_op_mutex
709                     PL_regex_pad
710                     PL_regex_padav
711                     PL_sharedsv_space
712                     PL_sharedsv_space_mutex
713                     PL_dollarzero_mutex
714                     Perl_dirp_dup
715                     Perl_cx_dup
716                     Perl_si_dup
717                     Perl_any_dup
718                     Perl_ss_dup
719                     Perl_fp_dup
720                     Perl_gp_dup
721                     Perl_he_dup
722                     Perl_mg_dup
723                     Perl_re_dup
724                     Perl_sv_dup
725                     Perl_rvpv_dup
726                     Perl_hek_dup
727                     Perl_sys_intern_dup
728                     Perl_ptr_table_clear
729                     Perl_ptr_table_fetch
730                     Perl_ptr_table_free
731                     Perl_ptr_table_new
732                     Perl_ptr_table_clear
733                     Perl_ptr_table_free
734                     Perl_ptr_table_split
735                     Perl_ptr_table_store
736                     perl_clone
737                     perl_clone_using
738                     Perl_sharedsv_find
739                     Perl_sharedsv_init
740                     Perl_sharedsv_lock
741                     Perl_sharedsv_new
742                     Perl_sharedsv_thrcnt_dec
743                     Perl_sharedsv_thrcnt_inc
744                     Perl_sharedsv_unlock
745                     Perl_stashpv_hvname_match
746                     )];
747 }
748
749 unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
750     skip_symbols [qw(
751                     Perl_croak_nocontext
752                     Perl_die_nocontext
753                     Perl_deb_nocontext
754                     Perl_form_nocontext
755                     Perl_load_module_nocontext
756                     Perl_mess_nocontext
757                     Perl_warn_nocontext
758                     Perl_warner_nocontext
759                     Perl_newSVpvf_nocontext
760                     Perl_sv_catpvf_nocontext
761                     Perl_sv_setpvf_nocontext
762                     Perl_sv_catpvf_mg_nocontext
763                     Perl_sv_setpvf_mg_nocontext
764                     )];
765 }
766
767 unless ($define{'PERL_IMPLICIT_SYS'}) {
768     skip_symbols [qw(
769                     perl_alloc_using
770                     perl_clone_using
771                     )];
772 }
773
774 unless ($define{'FAKE_THREADS'}) {
775     skip_symbols [qw(PL_curthr)];
776 }
777
778 unless ($define{'PL_OP_SLAB_ALLOC'}) {
779     skip_symbols [qw(
780                      PL_OpPtr
781                      PL_OpSlab
782                      PL_OpSpace
783                      Perl_Slab_Alloc
784                      Perl_Slab_Free
785                     )];
786 }
787
788 unless ($define{'THREADS_HAVE_PIDS'}) {
789     skip_symbols [qw(PL_ppid)];
790 }
791
792 unless ($define{'PERL_NEED_APPCTX'}) {
793     skip_symbols [qw(
794                     PL_appctx
795                     )];
796 }
797
798 unless ($define{'PERL_NEED_TIMESBASE'}) {
799     skip_symbols [qw(
800                     PL_timesbase
801                     )];
802 }
803
804 unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
805     skip_symbols [qw(
806                     PL_dumper_fd
807                     )];
808 }
809 unless ($define{'PERL_DONT_CREATE_GVSV'}) {
810     skip_symbols [qw(
811                      Perl_gv_SVadd
812                     )];
813 }
814 if ($define{'SPRINTF_RETURNS_STRLEN'}) {
815     skip_symbols [qw(
816                      Perl_my_sprintf
817                     )];
818 }
819 unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
820     skip_symbols [qw(
821                      Perl_pidgone
822                      PL_pidstatus
823                     )];
824 }
825
826 unless ($define{'d_mmap'}) {
827     skip_symbols [qw(
828                     PL_mmap_page_size
829                     )];
830 }
831
832 if ($define{'d_sigaction'}) {
833     skip_symbols [qw(
834                     PL_sig_trapped
835                     )];
836 }
837
838 if ($^O ne 'vms') {
839     # VMS does its own thing for these symbols.
840     skip_symbols [qw(PL_sig_handlers_initted
841                      PL_sig_ignoring
842                      PL_sig_defaulting)];
843 }  
844
845 sub readvar {
846     my $file = shift;
847     my $proc = shift || sub { "PL_$_[2]" };
848     open(VARS,$file) || die "Cannot open $file: $!\n";
849     my @syms;
850     while (<VARS>) {
851         # All symbols have a Perl_ prefix because that's what embed.h
852         # sticks in front of them.  The A?I?S?C? is strictly speaking
853         # wrong.
854         push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/);
855     }
856     close(VARS);
857     return \@syms;
858 }
859
860 if ($define{'PERL_GLOBAL_STRUCT'}) {
861     my $global = readvar($perlvars_h);
862     skip_symbols $global;
863     emit_symbol('Perl_GetVars');
864     emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
865 } else {
866     skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)];
867 }
868
869 # functions from *.sym files
870
871 my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
872
873 # Symbols that are the public face of the PerlIO layers implementation
874 # These are in _addition to_ the public face of the abstraction
875 # and need to be exported to allow XS modules to implement layers
876 my @layer_syms = qw(
877                     PerlIOBase_binmode
878                     PerlIOBase_clearerr
879                     PerlIOBase_close
880                     PerlIOBase_dup
881                     PerlIOBase_eof
882                     PerlIOBase_error
883                     PerlIOBase_fileno
884                     PerlIOBase_noop_fail
885                     PerlIOBase_noop_ok
886                     PerlIOBase_popped
887                     PerlIOBase_pushed
888                     PerlIOBase_read
889                     PerlIOBase_setlinebuf
890                     PerlIOBase_unread
891                     PerlIOBuf_bufsiz
892                     PerlIOBuf_close
893                     PerlIOBuf_dup
894                     PerlIOBuf_fill
895                     PerlIOBuf_flush
896                     PerlIOBuf_get_base
897                     PerlIOBuf_get_cnt
898                     PerlIOBuf_get_ptr
899                     PerlIOBuf_open
900                     PerlIOBuf_popped
901                     PerlIOBuf_pushed
902                     PerlIOBuf_read
903                     PerlIOBuf_seek
904                     PerlIOBuf_set_ptrcnt
905                     PerlIOBuf_tell
906                     PerlIOBuf_unread
907                     PerlIOBuf_write
908                     PerlIO_allocate
909                     PerlIO_apply_layera
910                     PerlIO_apply_layers
911                     PerlIO_arg_fetch
912                     PerlIO_debug
913                     PerlIO_define_layer
914                     PerlIO_isutf8
915                     PerlIO_layer_fetch
916                     PerlIO_list_free
917                     PerlIO_modestr
918                     PerlIO_parse_layers
919                     PerlIO_pending
920                     PerlIO_perlio
921                     PerlIO_pop
922                     PerlIO_push
923                     PerlIO_sv_dup
924                     Perl_PerlIO_clearerr
925                     Perl_PerlIO_close
926                     Perl_PerlIO_eof
927                     Perl_PerlIO_error
928                     Perl_PerlIO_fileno
929                     Perl_PerlIO_fill
930                     Perl_PerlIO_flush
931                     Perl_PerlIO_get_base
932                     Perl_PerlIO_get_bufsiz
933                     Perl_PerlIO_get_cnt
934                     Perl_PerlIO_get_ptr
935                     Perl_PerlIO_read
936                     Perl_PerlIO_seek
937                     Perl_PerlIO_set_cnt
938                     Perl_PerlIO_set_ptrcnt
939                     Perl_PerlIO_setlinebuf
940                     Perl_PerlIO_stderr
941                     Perl_PerlIO_stdin
942                     Perl_PerlIO_stdout
943                     Perl_PerlIO_tell
944                     Perl_PerlIO_unread
945                     Perl_PerlIO_write
946 );
947 if ($PLATFORM eq 'netware') {
948     push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
949 }
950
951 if ($define{'USE_PERLIO'}) {
952     # Export the symols that make up the PerlIO abstraction, regardless
953     # of its implementation - read from a file
954     push @syms, $perlio_sym;
955
956     # This part is then dependent on how the abstraction is implemented
957     if ($define{'USE_SFIO'}) {
958         # Old legacy non-stdio "PerlIO"
959         skip_symbols \@layer_syms;
960         skip_symbols [qw(perlsio_binmode)];
961         # SFIO defines most of the PerlIO routines as macros
962         # So undo most of what $perlio_sym has just done - d'oh !
963         # Perhaps it would be better to list the ones which do exist
964         # And emit them
965         skip_symbols [qw(
966                          PerlIO_canset_cnt
967                          PerlIO_clearerr
968                          PerlIO_close
969                          PerlIO_eof
970                          PerlIO_error
971                          PerlIO_exportFILE
972                          PerlIO_fast_gets
973                          PerlIO_fdopen
974                          PerlIO_fileno
975                          PerlIO_findFILE
976                          PerlIO_flush
977                          PerlIO_get_base
978                          PerlIO_get_bufsiz
979                          PerlIO_get_cnt
980                          PerlIO_get_ptr
981                          PerlIO_getc
982                          PerlIO_getname
983                          PerlIO_has_base
984                          PerlIO_has_cntptr
985                          PerlIO_importFILE
986                          PerlIO_open
987                          PerlIO_printf
988                          PerlIO_putc
989                          PerlIO_puts
990                          PerlIO_read
991                          PerlIO_releaseFILE
992                          PerlIO_reopen
993                          PerlIO_rewind
994                          PerlIO_seek
995                          PerlIO_set_cnt
996                          PerlIO_set_ptrcnt
997                          PerlIO_setlinebuf
998                          PerlIO_sprintf
999                          PerlIO_stderr
1000                          PerlIO_stdin
1001                          PerlIO_stdout
1002                          PerlIO_stdoutf
1003                          PerlIO_tell
1004                          PerlIO_ungetc
1005                          PerlIO_vprintf
1006                          PerlIO_write
1007                          PerlIO_perlio
1008                          Perl_PerlIO_clearerr
1009                          Perl_PerlIO_close
1010                          Perl_PerlIO_eof
1011                          Perl_PerlIO_error
1012                          Perl_PerlIO_fileno
1013                          Perl_PerlIO_fill
1014                          Perl_PerlIO_flush
1015                          Perl_PerlIO_get_base
1016                          Perl_PerlIO_get_bufsiz
1017                          Perl_PerlIO_get_cnt
1018                          Perl_PerlIO_get_ptr
1019                          Perl_PerlIO_read
1020                          Perl_PerlIO_seek
1021                          Perl_PerlIO_set_cnt
1022                          Perl_PerlIO_set_ptrcnt
1023                          Perl_PerlIO_setlinebuf
1024                          Perl_PerlIO_stderr
1025                          Perl_PerlIO_stdin
1026                          Perl_PerlIO_stdout
1027                          Perl_PerlIO_tell
1028                          Perl_PerlIO_unread
1029                          Perl_PerlIO_write
1030                          PL_def_layerlist
1031                          PL_known_layers
1032                          PL_perlio
1033                          )];
1034     }
1035     else {
1036         # PerlIO with layers - export implementation
1037         emit_symbols \@layer_syms;
1038         emit_symbols [qw(perlsio_binmode)];
1039     }
1040 } else {
1041         # -Uuseperlio
1042         # Skip the PerlIO layer symbols - although
1043         # nothing should have exported them anyway.
1044         skip_symbols \@layer_syms;
1045         skip_symbols [qw(perlsio_binmode)];
1046         skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
1047
1048         # Also do NOT add abstraction symbols from $perlio_sym
1049         # abstraction is done as #define to stdio
1050         # Remaining remnants that _may_ be functions
1051         # are handled in <DATA>
1052 }
1053
1054 for my $syms (@syms) {
1055     open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1056     while (<GLOBAL>) {
1057         next if (!/^[A-Za-z]/);
1058         # Functions have a Perl_ prefix
1059         # Variables have a PL_ prefix
1060         chomp($_);
1061         my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1062         $symbol .= $_;
1063         emit_symbol($symbol) unless exists $skip{$symbol};
1064     }
1065     close(GLOBAL);
1066 }
1067
1068 # variables
1069
1070 if ($define{'MULTIPLICITY'}) {
1071     for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
1072         my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1073         emit_symbols $glob;
1074     }
1075     # XXX AIX seems to want the perlvars.h symbols, for some reason
1076     if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') {     # OS/2 needs PL_thr_key
1077         my $glob = readvar($perlvars_h);
1078         emit_symbols $glob;
1079     }
1080 }
1081 else {
1082     unless ($define{'PERL_GLOBAL_STRUCT'}) {
1083         my $glob = readvar($perlvars_h);
1084         emit_symbols $glob;
1085     }
1086     unless ($define{'MULTIPLICITY'}) {
1087         my $glob = readvar($intrpvar_h);
1088         emit_symbols $glob;
1089     }
1090     unless ($define{'MULTIPLICITY'}) {
1091         my $glob = readvar($thrdvar_h);
1092         emit_symbols $glob;
1093     }
1094 }
1095
1096 sub try_symbol {
1097     my $symbol = shift;
1098
1099     return if $symbol !~ /^[A-Za-z_]/;
1100     return if $symbol =~ /^\#/;
1101     $symbol =~s/\r//g;
1102     chomp($symbol);
1103     return if exists $skip{$symbol};
1104     emit_symbol($symbol);
1105 }
1106
1107 while (<DATA>) {
1108     try_symbol($_);
1109 }
1110
1111 if ($PLATFORM =~ /^win(?:32|ce)$/) {
1112     foreach my $symbol (qw(
1113                             setuid
1114                             setgid
1115                             boot_DynaLoader
1116                             Perl_init_os_extras
1117                             Perl_thread_create
1118                             Perl_win32_init
1119                             Perl_win32_term
1120                             RunPerl
1121                             win32_async_check
1122                             win32_errno
1123                             win32_environ
1124                             win32_abort
1125                             win32_fstat
1126                             win32_stat
1127                             win32_pipe
1128                             win32_popen
1129                             win32_pclose
1130                             win32_rename
1131                             win32_setmode
1132                             win32_chsize
1133                             win32_lseek
1134                             win32_tell
1135                             win32_dup
1136                             win32_dup2
1137                             win32_open
1138                             win32_close
1139                             win32_eof
1140                             win32_read
1141                             win32_write
1142                             win32_spawnvp
1143                             win32_mkdir
1144                             win32_rmdir
1145                             win32_chdir
1146                             win32_flock
1147                             win32_execv
1148                             win32_execvp
1149                             win32_htons
1150                             win32_ntohs
1151                             win32_htonl
1152                             win32_ntohl
1153                             win32_inet_addr
1154                             win32_inet_ntoa
1155                             win32_socket
1156                             win32_bind
1157                             win32_listen
1158                             win32_accept
1159                             win32_connect
1160                             win32_send
1161                             win32_sendto
1162                             win32_recv
1163                             win32_recvfrom
1164                             win32_shutdown
1165                             win32_closesocket
1166                             win32_ioctlsocket
1167                             win32_setsockopt
1168                             win32_getsockopt
1169                             win32_getpeername
1170                             win32_getsockname
1171                             win32_gethostname
1172                             win32_gethostbyname
1173                             win32_gethostbyaddr
1174                             win32_getprotobyname
1175                             win32_getprotobynumber
1176                             win32_getservbyname
1177                             win32_getservbyport
1178                             win32_select
1179                             win32_endhostent
1180                             win32_endnetent
1181                             win32_endprotoent
1182                             win32_endservent
1183                             win32_getnetent
1184                             win32_getnetbyname
1185                             win32_getnetbyaddr
1186                             win32_getprotoent
1187                             win32_getservent
1188                             win32_sethostent
1189                             win32_setnetent
1190                             win32_setprotoent
1191                             win32_setservent
1192                             win32_getenv
1193                             win32_putenv
1194                             win32_perror
1195                             win32_malloc
1196                             win32_calloc
1197                             win32_realloc
1198                             win32_free
1199                             win32_sleep
1200                             win32_times
1201                             win32_access
1202                             win32_alarm
1203                             win32_chmod
1204                             win32_open_osfhandle
1205                             win32_get_osfhandle
1206                             win32_ioctl
1207                             win32_link
1208                             win32_unlink
1209                             win32_utime
1210                             win32_gettimeofday
1211                             win32_uname
1212                             win32_wait
1213                             win32_waitpid
1214                             win32_kill
1215                             win32_str_os_error
1216                             win32_opendir
1217                             win32_readdir
1218                             win32_telldir
1219                             win32_seekdir
1220                             win32_rewinddir
1221                             win32_closedir
1222                             win32_longpath
1223                             win32_os_id
1224                             win32_getpid
1225                             win32_crypt
1226                             win32_dynaload
1227                             win32_get_childenv
1228                             win32_free_childenv
1229                             win32_clearenv
1230                             win32_get_childdir
1231                             win32_free_childdir
1232                             win32_stdin
1233                             win32_stdout
1234                             win32_stderr
1235                             win32_ferror
1236                             win32_feof
1237                             win32_strerror
1238                             win32_fprintf
1239                             win32_printf
1240                             win32_vfprintf
1241                             win32_vprintf
1242                             win32_fread
1243                             win32_fwrite
1244                             win32_fopen
1245                             win32_fdopen
1246                             win32_freopen
1247                             win32_fclose
1248                             win32_fputs
1249                             win32_fputc
1250                             win32_ungetc
1251                             win32_getc
1252                             win32_fileno
1253                             win32_clearerr
1254                             win32_fflush
1255                             win32_ftell
1256                             win32_fseek
1257                             win32_fgetpos
1258                             win32_fsetpos
1259                             win32_rewind
1260                             win32_tmpfile
1261                             win32_setbuf
1262                             win32_setvbuf
1263                             win32_flushall
1264                             win32_fcloseall
1265                             win32_fgets
1266                             win32_gets
1267                             win32_fgetc
1268                             win32_putc
1269                             win32_puts
1270                             win32_getchar
1271                             win32_putchar
1272                            ))
1273     {
1274         try_symbol($symbol);
1275     }
1276     if ($CCTYPE eq "BORLAND") {
1277         try_symbol('_matherr');
1278     }
1279 }
1280 elsif ($PLATFORM eq 'os2') {
1281     open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1282     /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1283     close MAP or die 'Cannot close miniperl.map';
1284
1285     @missing = grep { !exists $mapped{$_} }
1286                     keys %export;
1287     @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1288     delete $export{$_} foreach @missing;
1289 }
1290 elsif ($PLATFORM eq 'MacOS') {
1291     open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1292
1293     while (<MACSYMS>) {
1294         try_symbol($_);
1295     }
1296
1297     close MACSYMS;
1298 }
1299 elsif ($PLATFORM eq 'netware') {
1300 foreach my $symbol (qw(
1301                         boot_DynaLoader
1302                         Perl_init_os_extras
1303                         Perl_thread_create
1304                         Perl_nw5_init
1305                         RunPerl
1306                         AllocStdPerl
1307                         FreeStdPerl
1308                         do_spawn2
1309                         do_aspawn
1310                         nw_uname
1311                         nw_stdin
1312                         nw_stdout
1313                         nw_stderr
1314                         nw_feof
1315                         nw_ferror
1316                         nw_fopen
1317                         nw_fclose
1318                         nw_clearerr
1319                         nw_getc
1320                         nw_fgets
1321                         nw_fputc
1322                         nw_fputs
1323                         nw_fflush
1324                         nw_ungetc
1325                         nw_fileno
1326                         nw_fdopen
1327                         nw_freopen
1328                         nw_fread
1329                         nw_fwrite
1330                         nw_setbuf
1331                         nw_setvbuf
1332                         nw_vfprintf
1333                         nw_ftell
1334                         nw_fseek
1335                         nw_rewind
1336                         nw_tmpfile
1337                         nw_fgetpos
1338                         nw_fsetpos
1339                         nw_dup
1340                         nw_access
1341                         nw_chmod
1342                         nw_chsize
1343                         nw_close
1344                         nw_dup2
1345                         nw_flock
1346                         nw_isatty
1347                         nw_link
1348                         nw_lseek
1349                         nw_stat
1350                         nw_mktemp
1351                         nw_open
1352                         nw_read
1353                         nw_rename
1354                         nw_setmode
1355                         nw_unlink
1356                         nw_utime
1357                         nw_write
1358                         nw_chdir
1359                         nw_rmdir
1360                         nw_closedir
1361                         nw_opendir
1362                         nw_readdir
1363                         nw_rewinddir
1364                         nw_seekdir
1365                         nw_telldir
1366                         nw_htonl
1367                         nw_htons
1368                         nw_ntohl
1369                         nw_ntohs
1370                         nw_accept
1371                         nw_bind
1372                         nw_connect
1373                         nw_endhostent
1374                         nw_endnetent
1375                         nw_endprotoent
1376                         nw_endservent
1377                         nw_gethostbyaddr
1378                         nw_gethostbyname
1379                         nw_gethostent
1380                         nw_gethostname
1381                         nw_getnetbyaddr
1382                         nw_getnetbyname
1383                         nw_getnetent
1384                         nw_getpeername
1385                         nw_getprotobyname
1386                         nw_getprotobynumber
1387                         nw_getprotoent
1388                         nw_getservbyname
1389                         nw_getservbyport
1390                         nw_getservent
1391                         nw_getsockname
1392                         nw_getsockopt
1393                         nw_inet_addr
1394                         nw_listen
1395                         nw_socket
1396                         nw_recv
1397                         nw_recvfrom
1398                         nw_select
1399                         nw_send
1400                         nw_sendto
1401                         nw_sethostent
1402                         nw_setnetent
1403                         nw_setprotoent
1404                         nw_setservent
1405                         nw_setsockopt
1406                         nw_inet_ntoa
1407                         nw_shutdown
1408                         nw_crypt
1409                         nw_execvp
1410                         nw_kill
1411                         nw_Popen
1412                         nw_Pclose
1413                         nw_Pipe
1414                         nw_times
1415                         nw_waitpid
1416                         nw_getpid
1417                         nw_spawnvp
1418                         nw_os_id
1419                         nw_open_osfhandle
1420                         nw_get_osfhandle
1421                         nw_abort
1422                         nw_sleep
1423                         nw_wait
1424                         nw_dynaload
1425                         nw_strerror
1426                         fnFpSetMode
1427                         fnInsertHashListAddrs
1428                         fnGetHashListAddrs
1429                         Perl_deb
1430                         Perl_sv_setsv
1431                         Perl_sv_catsv
1432                         Perl_sv_catpvn
1433                         Perl_sv_2pv
1434                         nw_freeenviron
1435                         Remove_Thread_Ctx
1436                            ))
1437     {
1438         try_symbol($symbol);
1439     }
1440 }
1441
1442 # records of type boot_module for statically linked modules (except Dynaloader)
1443 $static_ext =~ s/\//__/g;
1444 $static_ext =~ s/\bDynaLoader\b//;
1445 my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1446 foreach my $symbol (@stat_mods)
1447     {
1448         try_symbol($symbol);
1449     }
1450
1451 # Now all symbols should be defined because
1452 # next we are going to output them.
1453
1454 foreach my $symbol (sort keys %export) {
1455     output_symbol($symbol);
1456 }
1457
1458 if ($PLATFORM eq 'os2') {
1459         print <<EOP;
1460     dll_perlmain=main
1461     fill_extLibpath
1462     dir_subst
1463     Perl_OS2_handler_install
1464
1465 ; LAST_ORDINAL=$sym_ord
1466 EOP
1467 }
1468
1469 sub emit_symbol {
1470     my $symbol = shift;
1471     chomp($symbol);
1472     $export{$symbol} = 1;
1473 }
1474
1475 sub output_symbol {
1476     my $symbol = shift;
1477     if ($PLATFORM =~ /^win(?:32|ce)$/) {
1478         $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
1479         print "\t$symbol\n";
1480 # XXX: binary compatibility between compilers is an exercise
1481 # in frustration :-(
1482 #        if ($CCTYPE eq "BORLAND") {
1483 #           # workaround Borland quirk by exporting both the straight
1484 #           # name and a name with leading underscore.  Note the
1485 #           # alias *must* come after the symbol itself, if both
1486 #           # are to be exported. (Linker bug?)
1487 #           print "\t_$symbol\n";
1488 #           print "\t$symbol = _$symbol\n";
1489 #       }
1490 #       elsif ($CCTYPE eq 'GCC') {
1491 #           # Symbols have leading _ whole process is $%@"% slow
1492 #           # so skip aliases for now
1493 #           nprint "\t$symbol\n";
1494 #       }
1495 #       else {
1496 #           # for binary coexistence, export both the symbol and
1497 #           # alias with leading underscore
1498 #           print "\t$symbol\n";
1499 #           print "\t_$symbol = $symbol\n";
1500 #       }
1501     }
1502     elsif ($PLATFORM eq 'os2') {
1503         printf qq(    %-31s \@%s\n),
1504           qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
1505         printf qq(    %-31s \@%s\n),
1506           qq("$exportperlmalloc{$symbol}" = "$symbol"),
1507           $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1508           if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1509     }
1510     elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
1511         print "$symbol\n";
1512     }
1513         elsif ($PLATFORM eq 'netware') {
1514         print "\t$symbol,\n";
1515         }
1516 }
1517
1518 1;
1519 __DATA__
1520 # extra globals not included above.
1521 Perl_cxinc
1522 perl_alloc
1523 perl_alloc_using
1524 perl_clone
1525 perl_clone_using
1526 perl_construct
1527 perl_destruct
1528 perl_free
1529 perl_parse
1530 perl_run
1531 # Oddities from PerlIO
1532 PerlIO_binmode
1533 PerlIO_getpos
1534 PerlIO_init
1535 PerlIO_setpos
1536 PerlIO_sprintf
1537 PerlIO_sv_dup
1538 PerlIO_tmpfile
1539 PerlIO_vsprintf