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