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