This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[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 ($PLATFORM eq 'os2') {
103             $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
104             $ARCHNAME =    $1 if /^archname='(.+)'$/;
105             $PATCHLEVEL =  $1 if /^perl_patchlevel='(.+)'$/;
106         }
107     }
108     close(CFG);
109 }
110 if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
111     open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
112     if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
113         $static_ext = $1;
114     }
115     close(CFG);
116 }
117
118 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
119 while (<CFG>) {
120     $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
121     $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
122     $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
123     $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
124 }
125 close(CFG);
126
127 # perl.h logic duplication begins
128
129 if ($define{PERL_IMPLICIT_SYS}) {
130     $define{PL_OP_SLAB_ALLOC} = 1;
131 }
132
133 if ($define{USE_ITHREADS}) {
134     if (!$define{MULTIPLICITY}) {
135         $define{MULTIPLICITY} = 1;
136     }
137 }
138
139 $define{PERL_IMPLICIT_CONTEXT} ||=
140     $define{USE_ITHREADS} ||
141     $define{USE_5005THREADS}  ||
142     $define{MULTIPLICITY} ;
143
144 if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
145     $define{USE_REENTRANT_API} = 1;
146 }
147
148 # perl.h logic duplication ends
149
150 my $sym_ord = 0;
151
152 print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
153
154 if ($PLATFORM =~ /^win(?:32|ce)$/) {
155     ($dll = ($define{PERL_DLL} || "perl58")) =~ s/\.dll$//i;
156     print "LIBRARY $dll\n";
157     print "DESCRIPTION 'Perl interpreter'\n";
158     print "EXPORTS\n";
159     if ($define{PERL_IMPLICIT_SYS}) {
160         output_symbol("perl_get_host_info");
161         output_symbol("perl_alloc_override");
162     }
163     if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
164         output_symbol("perl_clone_host");
165     }
166 }
167 elsif ($PLATFORM eq 'os2') {
168     if (open my $fh, '<', 'perl5.def') {
169       while (<$fh>) {
170         last if /^\s*EXPORTS\b/;
171       }
172       while (<$fh>) {
173         $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
174         # This allows skipping ordinals which were used in older versions
175         $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
176       }
177       $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
178     }
179     ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
180     $v .= '-thread' if $ARCHNAME =~ /-thread/;
181     ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
182     $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
183     $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
184     $d = substr($d, 0, 249) . "...'" if length $d > 253;
185     print <<"---EOP---";
186 LIBRARY '$dll' INITINSTANCE TERMINSTANCE
187 $d
188 STACKSIZE 32768
189 CODE LOADONCALL
190 DATA LOADONCALL NONSHARED MULTIPLE
191 EXPORTS
192 ---EOP---
193 }
194 elsif ($PLATFORM eq 'aix') {
195     $OSVER = `uname -v`;
196     chop $OSVER;
197     $OSREL = `uname -r`;
198     chop $OSREL;
199     if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
200         print "#! ..\n";
201     } else {
202         print "#!\n";
203     }
204 }
205 elsif ($PLATFORM eq 'netware') {
206         if ($FILETYPE eq 'def') {
207         print "LIBRARY perl58\n";
208         print "DESCRIPTION 'Perl interpreter for NetWare'\n";
209         print "EXPORTS\n";
210         }
211         if ($define{PERL_IMPLICIT_SYS}) {
212             output_symbol("perl_get_host_info");
213             output_symbol("perl_alloc_override");
214             output_symbol("perl_clone_host");
215         }
216 }
217
218 my %skip;
219 my %export;
220
221 sub skip_symbols {
222     my $list = shift;
223     foreach my $symbol (@$list) {
224         $skip{$symbol} = 1;
225     }
226 }
227
228 sub emit_symbols {
229     my $list = shift;
230     foreach my $symbol (@$list) {
231         my $skipsym = $symbol;
232         # XXX hack
233         if ($define{MULTIPLICITY}) {
234             $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
235         }
236         emit_symbol($symbol) unless exists $skip{$skipsym};
237     }
238 }
239
240 if ($PLATFORM eq 'win32') {
241     skip_symbols [qw(
242                      PL_statusvalue_vms
243                      PL_archpat_auto
244                      PL_cryptseen
245                      PL_DBcv
246                      PL_generation
247                      PL_lastgotoprobe
248                      PL_linestart
249                      PL_modcount
250                      PL_pending_ident
251                      PL_sublex_info
252                      PL_timesbuf
253                      main
254                      Perl_ErrorNo
255                      Perl_GetVars
256                      Perl_do_exec3
257                      Perl_do_ipcctl
258                      Perl_do_ipcget
259                      Perl_do_msgrcv
260                      Perl_do_msgsnd
261                      Perl_do_semop
262                      Perl_do_shmio
263                      Perl_dump_fds
264                      Perl_init_thread_intern
265                      Perl_my_bzero
266                      Perl_my_bcopy
267                      Perl_my_htonl
268                      Perl_my_ntohl
269                      Perl_my_swap
270                      Perl_my_chsize
271                      Perl_same_dirent
272                      Perl_setenv_getix
273                      Perl_unlnk
274                      Perl_watch
275                      Perl_safexcalloc
276                      Perl_safexmalloc
277                      Perl_safexfree
278                      Perl_safexrealloc
279                      Perl_my_memcmp
280                      Perl_my_memset
281                      PL_cshlen
282                      PL_cshname
283                      PL_opsave
284                      Perl_do_exec
285                      Perl_getenv_len
286                      Perl_my_pclose
287                      Perl_my_popen
288                      Perl_my_sprintf
289                      )];
290 }
291 else {
292     skip_symbols [qw(
293                      Perl_do_spawn
294                      Perl_do_spawn_nowait
295                      Perl_do_aspawn
296                      )];
297 }
298 if ($PLATFORM eq 'wince') {
299     skip_symbols [qw(
300                      PL_statusvalue_vms
301                      PL_archpat_auto
302                      PL_cryptseen
303                      PL_DBcv
304                      PL_generation
305                      PL_lastgotoprobe
306                      PL_linestart
307                      PL_modcount
308                      PL_pending_ident
309                      PL_sublex_info
310                      PL_timesbuf
311                      PL_collation_ix
312                      PL_collation_name
313                      PL_collation_standard
314                      PL_collxfrm_base
315                      PL_collxfrm_mult
316                      PL_numeric_compat1
317                      PL_numeric_local
318                      PL_numeric_name
319                      PL_numeric_radix_sv
320                      PL_numeric_standard
321                      PL_vtbl_collxfrm
322                      Perl_sv_collxfrm
323                      setgid
324                      setuid
325                      win32_free_childdir
326                      win32_free_childenv
327                      win32_get_childdir
328                      win32_get_childenv
329                      win32_spawnvp
330                      main
331                      Perl_ErrorNo
332                      Perl_GetVars
333                      Perl_do_exec3
334                      Perl_do_ipcctl
335                      Perl_do_ipcget
336                      Perl_do_msgrcv
337                      Perl_do_msgsnd
338                      Perl_do_semop
339                      Perl_do_shmio
340                      Perl_dump_fds
341                      Perl_init_thread_intern
342                      Perl_my_bzero
343                      Perl_my_bcopy
344                      Perl_my_htonl
345                      Perl_my_ntohl
346                      Perl_my_swap
347                      Perl_my_chsize
348                      Perl_same_dirent
349                      Perl_setenv_getix
350                      Perl_unlnk
351                      Perl_watch
352                      Perl_safexcalloc
353                      Perl_safexmalloc
354                      Perl_safexfree
355                      Perl_safexrealloc
356                      Perl_my_memcmp
357                      Perl_my_memset
358                      PL_cshlen
359                      PL_cshname
360                      PL_opsave
361                      Perl_do_exec
362                      Perl_getenv_len
363                      Perl_my_pclose
364                      Perl_my_popen
365                      Perl_my_sprintf
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                     Perl_hv_assert
585                     PL_block_type
586                     PL_watchaddr
587                     PL_watchok
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_FLEXIBLE_EXCEPTIONS'}) {
619     skip_symbols [qw(
620                     PL_protect
621                     Perl_default_protect
622                     Perl_vdefault_protect
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_5005THREADS'} || $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_5005THREADS'} || $define{'USE_ITHREADS'}) {
670     skip_symbols [qw(
671                     PL_thr_key
672                     )];
673 }
674
675 unless ($define{'USE_5005THREADS'}) {
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
704 unless ($define{'USE_ITHREADS'}) {
705     skip_symbols [qw(
706                     PL_ptr_table
707                     PL_pte_root
708                     PL_pte_arenaroot
709                     PL_op_mutex
710                     PL_regex_pad
711                     PL_regex_padav
712                     PL_sharedsv_space
713                     PL_sharedsv_space_mutex
714                     PL_dollarzero_mutex
715                     Perl_dirp_dup
716                     Perl_cx_dup
717                     Perl_si_dup
718                     Perl_any_dup
719                     Perl_ss_dup
720                     Perl_fp_dup
721                     Perl_gp_dup
722                     Perl_he_dup
723                     Perl_mg_dup
724                     Perl_re_dup
725                     Perl_sv_dup
726                     Perl_rvpv_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{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
793     skip_symbols [qw(
794                     PL_dumper_fd
795                     )];
796 }
797 unless ($define{'PERL_DONT_CREATE_GVSV'}) {
798     skip_symbols [qw(
799                      Perl_gv_SVadd
800                     )];
801 }
802 if ($define{'SPRINTF_RETURNS_STRLEN'}) {
803     skip_symbols [qw(
804                      Perl_my_sprintf
805                     )];
806 }
807
808 # Ideally this would also check SA_SIGINFO, but there doesn't seem to be an
809 # easy way to find that out from here. Fix it if it breaks because there is
810 # a platform where the logic here doesn't work, *and* the export lists have to
811 # be accurate there.
812 unless ($define{'d_sigaction'}) {
813     skip_symbols [qw(
814                     Perl_csighandler_va
815                     )];
816 }
817
818 sub readvar {
819     my $file = shift;
820     my $proc = shift || sub { "PL_$_[2]" };
821     open(VARS,$file) || die "Cannot open $file: $!\n";
822     my @syms;
823     while (<VARS>) {
824         # All symbols have a Perl_ prefix because that's what embed.h
825         # sticks in front of them.
826         push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
827     }
828     close(VARS);
829     return \@syms;
830 }
831
832 if ($define{'USE_5005THREADS'}) {
833     my $thrd = readvar($thrdvar_h);
834     skip_symbols $thrd;
835 }
836
837 if ($define{'PERL_GLOBAL_STRUCT'}) {
838     my $global = readvar($perlvars_h);
839     skip_symbols $global;
840     emit_symbol('Perl_GetVars');
841     emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
842 }
843
844 # functions from *.sym files
845
846 my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
847
848 # Symbols that are the public face of the PerlIO layers implementation
849 # These are in _addition to_ the public face of the abstraction
850 # and need to be exported to allow XS modules to implement layers
851 my @layer_syms = qw(
852                     PerlIOBase_binmode
853                     PerlIOBase_clearerr
854                     PerlIOBase_close
855                     PerlIOBase_dup
856                     PerlIOBase_eof
857                     PerlIOBase_error
858                     PerlIOBase_fileno
859                     PerlIOBase_noop_fail
860                     PerlIOBase_noop_ok
861                     PerlIOBase_popped
862                     PerlIOBase_pushed
863                     PerlIOBase_read
864                     PerlIOBase_setlinebuf
865                     PerlIOBase_unread
866                     PerlIOBuf_bufsiz
867                     PerlIOBuf_close
868                     PerlIOBuf_dup
869                     PerlIOBuf_fill
870                     PerlIOBuf_flush
871                     PerlIOBuf_get_base
872                     PerlIOBuf_get_cnt
873                     PerlIOBuf_get_ptr
874                     PerlIOBuf_open
875                     PerlIOBuf_popped
876                     PerlIOBuf_pushed
877                     PerlIOBuf_read
878                     PerlIOBuf_seek
879                     PerlIOBuf_set_ptrcnt
880                     PerlIOBuf_tell
881                     PerlIOBuf_unread
882                     PerlIOBuf_write
883                     PerlIO_allocate
884                     PerlIO_apply_layera
885                     PerlIO_apply_layers
886                     PerlIO_arg_fetch
887                     PerlIO_debug
888                     PerlIO_define_layer
889                     PerlIO_isutf8
890                     PerlIO_layer_fetch
891                     PerlIO_list_free
892                     PerlIO_modestr
893                     PerlIO_parse_layers
894                     PerlIO_pending
895                     PerlIO_perlio
896                     PerlIO_pop
897                     PerlIO_push
898                     PerlIO_sv_dup
899                     Perl_PerlIO_clearerr
900                     Perl_PerlIO_close
901                     Perl_PerlIO_eof
902                     Perl_PerlIO_error
903                     Perl_PerlIO_fileno
904                     Perl_PerlIO_fill
905                     Perl_PerlIO_flush
906                     Perl_PerlIO_get_base
907                     Perl_PerlIO_get_bufsiz
908                     Perl_PerlIO_get_cnt
909                     Perl_PerlIO_get_ptr
910                     Perl_PerlIO_read
911                     Perl_PerlIO_seek
912                     Perl_PerlIO_set_cnt
913                     Perl_PerlIO_set_ptrcnt
914                     Perl_PerlIO_setlinebuf
915                     Perl_PerlIO_stderr
916                     Perl_PerlIO_stdin
917                     Perl_PerlIO_stdout
918                     Perl_PerlIO_tell
919                     Perl_PerlIO_unread
920                     Perl_PerlIO_write
921 );
922 if ($PLATFORM eq 'netware') {
923     push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
924 }
925
926 if ($define{'USE_PERLIO'}) {
927     # Export the symols that make up the PerlIO abstraction, regardless
928     # of its implementation - read from a file
929     push @syms, $perlio_sym;
930
931     # This part is then dependent on how the abstraction is implemented
932     if ($define{'USE_SFIO'}) {
933         # Old legacy non-stdio "PerlIO"
934         skip_symbols \@layer_syms;
935         skip_symbols [qw(perlsio_binmode)];
936         # SFIO defines most of the PerlIO routines as macros
937         # So undo most of what $perlio_sym has just done - d'oh !
938         # Perhaps it would be better to list the ones which do exist
939         # And emit them
940         skip_symbols [qw(
941                          PerlIO_canset_cnt
942                          PerlIO_clearerr
943                          PerlIO_close
944                          PerlIO_eof
945                          PerlIO_error
946                          PerlIO_exportFILE
947                          PerlIO_fast_gets
948                          PerlIO_fdopen
949                          PerlIO_fileno
950                          PerlIO_findFILE
951                          PerlIO_flush
952                          PerlIO_get_base
953                          PerlIO_get_bufsiz
954                          PerlIO_get_cnt
955                          PerlIO_get_ptr
956                          PerlIO_getc
957                          PerlIO_getname
958                          PerlIO_has_base
959                          PerlIO_has_cntptr
960                          PerlIO_importFILE
961                          PerlIO_open
962                          PerlIO_printf
963                          PerlIO_putc
964                          PerlIO_puts
965                          PerlIO_read
966                          PerlIO_releaseFILE
967                          PerlIO_reopen
968                          PerlIO_rewind
969                          PerlIO_seek
970                          PerlIO_set_cnt
971                          PerlIO_set_ptrcnt
972                          PerlIO_setlinebuf
973                          PerlIO_sprintf
974                          PerlIO_stderr
975                          PerlIO_stdin
976                          PerlIO_stdout
977                          PerlIO_stdoutf
978                          PerlIO_tell
979                          PerlIO_ungetc
980                          PerlIO_vprintf
981                          PerlIO_write
982                          PerlIO_perlio
983                          Perl_PerlIO_clearerr
984                          Perl_PerlIO_close
985                          Perl_PerlIO_eof
986                          Perl_PerlIO_error
987                          Perl_PerlIO_fileno
988                          Perl_PerlIO_fill
989                          Perl_PerlIO_flush
990                          Perl_PerlIO_get_base
991                          Perl_PerlIO_get_bufsiz
992                          Perl_PerlIO_get_cnt
993                          Perl_PerlIO_get_ptr
994                          Perl_PerlIO_read
995                          Perl_PerlIO_seek
996                          Perl_PerlIO_set_cnt
997                          Perl_PerlIO_set_ptrcnt
998                          Perl_PerlIO_setlinebuf
999                          Perl_PerlIO_stderr
1000                          Perl_PerlIO_stdin
1001                          Perl_PerlIO_stdout
1002                          Perl_PerlIO_tell
1003                          Perl_PerlIO_unread
1004                          Perl_PerlIO_write
1005                          PL_def_layerlist
1006                          PL_known_layers
1007                          PL_perlio
1008                          )];
1009     }
1010     else {
1011         # PerlIO with layers - export implementation
1012         emit_symbols \@layer_syms;
1013         emit_symbols [qw(perlsio_binmode)];
1014     }
1015 } else {
1016         # -Uuseperlio
1017         # Skip the PerlIO layer symbols - although
1018         # nothing should have exported them any way
1019         skip_symbols \@layer_syms;
1020         skip_symbols [qw(perlsio_binmode)];
1021         skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
1022
1023         # Also do NOT add abstraction symbols from $perlio_sym
1024         # abstraction is done as #define to stdio
1025         # Remaining remnants that _may_ be functions
1026         # are handled in <DATA>
1027 }
1028
1029 for my $syms (@syms) {
1030     open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1031     while (<GLOBAL>) {
1032         next if (!/^[A-Za-z]/);
1033         # Functions have a Perl_ prefix
1034         # Variables have a PL_ prefix
1035         chomp($_);
1036         my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1037         $symbol .= $_;
1038         emit_symbol($symbol) unless exists $skip{$symbol};
1039     }
1040     close(GLOBAL);
1041 }
1042
1043 # variables
1044
1045 if ($define{'MULTIPLICITY'}) {
1046     for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
1047         my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1048         emit_symbols $glob;
1049     }
1050     # XXX AIX seems to want the perlvars.h symbols, for some reason
1051     if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') {     # OS/2 needs PL_thr_key
1052         my $glob = readvar($perlvars_h);
1053         emit_symbols $glob;
1054     }
1055 }
1056 else {
1057     unless ($define{'PERL_GLOBAL_STRUCT'}) {
1058         my $glob = readvar($perlvars_h);
1059         emit_symbols $glob;
1060     }
1061     unless ($define{'MULTIPLICITY'}) {
1062         my $glob = readvar($intrpvar_h);
1063         emit_symbols $glob;
1064     }
1065     unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
1066         my $glob = readvar($thrdvar_h);
1067         emit_symbols $glob;
1068     }
1069 }
1070
1071 sub try_symbol {
1072     my $symbol = shift;
1073
1074     return if $symbol !~ /^[A-Za-z_]/;
1075     return if $symbol =~ /^\#/;
1076     $symbol =~s/\r//g;
1077     chomp($symbol);
1078     return if exists $skip{$symbol};
1079     emit_symbol($symbol);
1080 }
1081
1082 while (<DATA>) {
1083     try_symbol($_);
1084 }
1085
1086 if ($PLATFORM =~ /^win(?:32|ce)$/) {
1087     foreach my $symbol (qw(
1088                             setuid
1089                             setgid
1090                             boot_DynaLoader
1091                             Perl_init_os_extras
1092                             Perl_thread_create
1093                             Perl_win32_init
1094                             Perl_win32_term
1095                             RunPerl
1096                             win32_async_check
1097                             win32_errno
1098                             win32_environ
1099                             win32_abort
1100                             win32_fstat
1101                             win32_stat
1102                             win32_pipe
1103                             win32_popen
1104                             win32_pclose
1105                             win32_rename
1106                             win32_setmode
1107                             win32_chsize
1108                             win32_lseek
1109                             win32_tell
1110                             win32_dup
1111                             win32_dup2
1112                             win32_open
1113                             win32_close
1114                             win32_eof
1115                             win32_read
1116                             win32_write
1117                             win32_spawnvp
1118                             win32_mkdir
1119                             win32_rmdir
1120                             win32_chdir
1121                             win32_flock
1122                             win32_execv
1123                             win32_execvp
1124                             win32_htons
1125                             win32_ntohs
1126                             win32_htonl
1127                             win32_ntohl
1128                             win32_inet_addr
1129                             win32_inet_ntoa
1130                             win32_socket
1131                             win32_bind
1132                             win32_listen
1133                             win32_accept
1134                             win32_connect
1135                             win32_send
1136                             win32_sendto
1137                             win32_recv
1138                             win32_recvfrom
1139                             win32_shutdown
1140                             win32_closesocket
1141                             win32_ioctlsocket
1142                             win32_setsockopt
1143                             win32_getsockopt
1144                             win32_getpeername
1145                             win32_getsockname
1146                             win32_gethostname
1147                             win32_gethostbyname
1148                             win32_gethostbyaddr
1149                             win32_getprotobyname
1150                             win32_getprotobynumber
1151                             win32_getservbyname
1152                             win32_getservbyport
1153                             win32_select
1154                             win32_endhostent
1155                             win32_endnetent
1156                             win32_endprotoent
1157                             win32_endservent
1158                             win32_getnetent
1159                             win32_getnetbyname
1160                             win32_getnetbyaddr
1161                             win32_getprotoent
1162                             win32_getservent
1163                             win32_sethostent
1164                             win32_setnetent
1165                             win32_setprotoent
1166                             win32_setservent
1167                             win32_getenv
1168                             win32_putenv
1169                             win32_perror
1170                             win32_malloc
1171                             win32_calloc
1172                             win32_realloc
1173                             win32_free
1174                             win32_sleep
1175                             win32_times
1176                             win32_access
1177                             win32_alarm
1178                             win32_chmod
1179                             win32_open_osfhandle
1180                             win32_get_osfhandle
1181                             win32_ioctl
1182                             win32_link
1183                             win32_unlink
1184                             win32_utime
1185                             win32_gettimeofday
1186                             win32_uname
1187                             win32_wait
1188                             win32_waitpid
1189                             win32_kill
1190                             win32_str_os_error
1191                             win32_opendir
1192                             win32_readdir
1193                             win32_telldir
1194                             win32_seekdir
1195                             win32_rewinddir
1196                             win32_closedir
1197                             win32_longpath
1198                             win32_os_id
1199                             win32_getpid
1200                             win32_crypt
1201                             win32_dynaload
1202                             win32_get_childenv
1203                             win32_free_childenv
1204                             win32_clearenv
1205                             win32_get_childdir
1206                             win32_free_childdir
1207                             win32_stdin
1208                             win32_stdout
1209                             win32_stderr
1210                             win32_ferror
1211                             win32_feof
1212                             win32_strerror
1213                             win32_fprintf
1214                             win32_printf
1215                             win32_vfprintf
1216                             win32_vprintf
1217                             win32_fread
1218                             win32_fwrite
1219                             win32_fopen
1220                             win32_fdopen
1221                             win32_freopen
1222                             win32_fclose
1223                             win32_fputs
1224                             win32_fputc
1225                             win32_ungetc
1226                             win32_getc
1227                             win32_fileno
1228                             win32_clearerr
1229                             win32_fflush
1230                             win32_ftell
1231                             win32_fseek
1232                             win32_fgetpos
1233                             win32_fsetpos
1234                             win32_rewind
1235                             win32_tmpfile
1236                             win32_setbuf
1237                             win32_setvbuf
1238                             win32_flushall
1239                             win32_fcloseall
1240                             win32_fgets
1241                             win32_gets
1242                             win32_fgetc
1243                             win32_putc
1244                             win32_puts
1245                             win32_getchar
1246                             win32_putchar
1247                            ))
1248     {
1249         try_symbol($symbol);
1250     }
1251     if ($CCTYPE eq "BORLAND") {
1252         try_symbol('_matherr');
1253     }
1254 }
1255 elsif ($PLATFORM eq 'os2') {
1256     open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1257     /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1258     close MAP or die 'Cannot close miniperl.map';
1259
1260     @missing = grep { !exists $mapped{$_} }
1261                     keys %export;
1262     @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1263     delete $export{$_} foreach @missing;
1264 }
1265 elsif ($PLATFORM eq 'MacOS') {
1266     open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1267
1268     while (<MACSYMS>) {
1269         try_symbol($_);
1270     }
1271
1272     close MACSYMS;
1273 }
1274 elsif ($PLATFORM eq 'netware') {
1275 foreach my $symbol (qw(
1276                         boot_DynaLoader
1277                         Perl_init_os_extras
1278                         Perl_thread_create
1279                         Perl_nw5_init
1280                         RunPerl
1281                         AllocStdPerl
1282                         FreeStdPerl
1283                         do_spawn2
1284                         do_aspawn
1285                         nw_uname
1286                         nw_stdin
1287                         nw_stdout
1288                         nw_stderr
1289                         nw_feof
1290                         nw_ferror
1291                         nw_fopen
1292                         nw_fclose
1293                         nw_clearerr
1294                         nw_getc
1295                         nw_fgets
1296                         nw_fputc
1297                         nw_fputs
1298                         nw_fflush
1299                         nw_ungetc
1300                         nw_fileno
1301                         nw_fdopen
1302                         nw_freopen
1303                         nw_fread
1304                         nw_fwrite
1305                         nw_setbuf
1306                         nw_setvbuf
1307                         nw_vfprintf
1308                         nw_ftell
1309                         nw_fseek
1310                         nw_rewind
1311                         nw_tmpfile
1312                         nw_fgetpos
1313                         nw_fsetpos
1314                         nw_dup
1315                         nw_access
1316                         nw_chmod
1317                         nw_chsize
1318                         nw_close
1319                         nw_dup2
1320                         nw_flock
1321                         nw_isatty
1322                         nw_link
1323                         nw_lseek
1324                         nw_stat
1325                         nw_mktemp
1326                         nw_open
1327                         nw_read
1328                         nw_rename
1329                         nw_setmode
1330                         nw_unlink
1331                         nw_utime
1332                         nw_write
1333                         nw_chdir
1334                         nw_rmdir
1335                         nw_closedir
1336                         nw_opendir
1337                         nw_readdir
1338                         nw_rewinddir
1339                         nw_seekdir
1340                         nw_telldir
1341                         nw_htonl
1342                         nw_htons
1343                         nw_ntohl
1344                         nw_ntohs
1345                         nw_accept
1346                         nw_bind
1347                         nw_connect
1348                         nw_endhostent
1349                         nw_endnetent
1350                         nw_endprotoent
1351                         nw_endservent
1352                         nw_gethostbyaddr
1353                         nw_gethostbyname
1354                         nw_gethostent
1355                         nw_gethostname
1356                         nw_getnetbyaddr
1357                         nw_getnetbyname
1358                         nw_getnetent
1359                         nw_getpeername
1360                         nw_getprotobyname
1361                         nw_getprotobynumber
1362                         nw_getprotoent
1363                         nw_getservbyname
1364                         nw_getservbyport
1365                         nw_getservent
1366                         nw_getsockname
1367                         nw_getsockopt
1368                         nw_inet_addr
1369                         nw_listen
1370                         nw_socket
1371                         nw_recv
1372                         nw_recvfrom
1373                         nw_select
1374                         nw_send
1375                         nw_sendto
1376                         nw_sethostent
1377                         nw_setnetent
1378                         nw_setprotoent
1379                         nw_setservent
1380                         nw_setsockopt
1381                         nw_inet_ntoa
1382                         nw_shutdown
1383                         nw_crypt
1384                         nw_execvp
1385                         nw_kill
1386                         nw_Popen
1387                         nw_Pclose
1388                         nw_Pipe
1389                         nw_times
1390                         nw_waitpid
1391                         nw_getpid
1392                         nw_spawnvp
1393                         nw_os_id
1394                         nw_open_osfhandle
1395                         nw_get_osfhandle
1396                         nw_abort
1397                         nw_sleep
1398                         nw_wait
1399                         nw_dynaload
1400                         nw_strerror
1401                         fnFpSetMode
1402                         fnInsertHashListAddrs
1403                         fnGetHashListAddrs
1404                         Perl_deb
1405                         Perl_sv_setsv
1406                         Perl_sv_catsv
1407                         Perl_sv_catpvn
1408                         Perl_sv_2pv
1409                         nw_freeenviron
1410                         Remove_Thread_Ctx
1411                            ))
1412     {
1413         try_symbol($symbol);
1414     }
1415 }
1416
1417 # records of type boot_module for statically linked modules (except Dynaloader)
1418 $static_ext =~ s/\//__/g;
1419 $static_ext =~ s/\bDynaLoader\b//;
1420 my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1421 foreach my $symbol (@stat_mods)
1422     {
1423         try_symbol($symbol);
1424     }
1425
1426 # Now all symbols should be defined because
1427 # next we are going to output them.
1428
1429 foreach my $symbol (sort keys %export) {
1430     output_symbol($symbol);
1431 }
1432
1433 if ($PLATFORM eq 'os2') {
1434         print <<EOP;
1435     dll_perlmain=main
1436     fill_extLibpath
1437     dir_subst
1438     Perl_OS2_handler_install
1439
1440 ; LAST_ORDINAL=$sym_ord
1441 EOP
1442 }
1443
1444 sub emit_symbol {
1445     my $symbol = shift;
1446     chomp($symbol);
1447     $export{$symbol} = 1;
1448 }
1449
1450 sub output_symbol {
1451     my $symbol = shift;
1452     if ($PLATFORM =~ /^win(?:32|ce)$/) {
1453         $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
1454         print "\t$symbol\n";
1455 # XXX: binary compatibility between compilers is an exercise
1456 # in frustration :-(
1457 #        if ($CCTYPE eq "BORLAND") {
1458 #           # workaround Borland quirk by exporting both the straight
1459 #           # name and a name with leading underscore.  Note the
1460 #           # alias *must* come after the symbol itself, if both
1461 #           # are to be exported. (Linker bug?)
1462 #           print "\t_$symbol\n";
1463 #           print "\t$symbol = _$symbol\n";
1464 #       }
1465 #       elsif ($CCTYPE eq 'GCC') {
1466 #           # Symbols have leading _ whole process is $%@"% slow
1467 #           # so skip aliases for now
1468 #           nprint "\t$symbol\n";
1469 #       }
1470 #       else {
1471 #           # for binary coexistence, export both the symbol and
1472 #           # alias with leading underscore
1473 #           print "\t$symbol\n";
1474 #           print "\t_$symbol = $symbol\n";
1475 #       }
1476     }
1477     elsif ($PLATFORM eq 'os2') {
1478         printf qq(    %-31s \@%s\n),
1479           qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
1480         printf qq(    %-31s \@%s\n),
1481           qq("$exportperlmalloc{$symbol}" = "$symbol"),
1482           $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1483           if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1484     }
1485     elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
1486         print "$symbol\n";
1487     }
1488         elsif ($PLATFORM eq 'netware') {
1489         print "\t$symbol,\n";
1490         }
1491 }
1492
1493 1;
1494 __DATA__
1495 # extra globals not included above.
1496 Perl_cxinc
1497 perl_alloc
1498 perl_alloc_using
1499 perl_clone
1500 perl_clone_using
1501 perl_construct
1502 perl_destruct
1503 perl_free
1504 perl_parse
1505 perl_run
1506 # Oddities from PerlIO
1507 PerlIO_binmode
1508 PerlIO_getpos
1509 PerlIO_init
1510 PerlIO_setpos
1511 PerlIO_sprintf
1512 PerlIO_sv_dup
1513 PerlIO_tmpfile
1514 PerlIO_vsprintf